javax.xml.crypto.dsig.TransformService Maven / Gradle / Ivy
The newest version!
/* */ package javax.xml.crypto.dsig;
/* */
/* */ import java.security.InvalidAlgorithmParameterException;
/* */ import java.security.NoSuchAlgorithmException;
/* */ import java.security.NoSuchProviderException;
/* */ import java.security.Provider;
/* */ import java.security.Security;
/* */ import java.util.Map.Entry;
/* */ import javax.xml.crypto.MarshalException;
/* */ import javax.xml.crypto.XMLCryptoContext;
/* */ import javax.xml.crypto.XMLStructure;
/* */ import javax.xml.crypto.dsig.spec.TransformParameterSpec;
/* */
/* */ public abstract class TransformService
/* */ implements Transform
/* */ {
/* */ private String algorithm;
/* */ private String mechanism;
/* */ private Provider provider;
/* */
/* */ public static TransformService getInstance(String algorithm, String mechanismType)
/* */ throws NoSuchAlgorithmException
/* */ {
/* 127 */ if ((mechanismType == null) || (algorithm == null)) {
/* 128 */ throw new NullPointerException();
/* */ }
/* 130 */ return findInstance(algorithm, mechanismType, null);
/* */ }
/* */
/* */ public static TransformService getInstance(String algorithm, String mechanismType, Provider provider)
/* */ throws NoSuchAlgorithmException
/* */ {
/* 156 */ if ((mechanismType == null) || (algorithm == null) || (provider == null)) {
/* 157 */ throw new NullPointerException();
/* */ }
/* 159 */ return findInstance(algorithm, mechanismType, provider);
/* */ }
/* */
/* */ public static TransformService getInstance(String algorithm, String mechanismType, String provider)
/* */ throws NoSuchAlgorithmException, NoSuchProviderException
/* */ {
/* 189 */ if ((mechanismType == null) || (algorithm == null) || (provider == null)) {
/* 190 */ throw new NullPointerException();
/* */ }
/* 192 */ Provider prov = Security.getProvider(provider);
/* 193 */ if (prov == null) {
/* 194 */ throw new NoSuchProviderException("cannot find provider named " + provider);
/* */ }
/* */
/* 197 */ return findInstance(algorithm, mechanismType, prov);
/* */ }
/* */
/* */ private static TransformService findInstance(String algorithm, String mechanismType, Provider provider)
/* */ throws NoSuchAlgorithmException
/* */ {
/* 204 */ Object[] objs = (Object[])XMLDSigSecurity.getImpl(algorithm, new MechanismMapEntry(algorithm, mechanismType), "TransformService", provider);
/* */
/* 208 */ TransformService spi = (TransformService)objs[0];
/* 209 */ spi.mechanism = mechanismType;
/* 210 */ spi.algorithm = algorithm;
/* 211 */ spi.provider = ((Provider)objs[1]);
/* 212 */ return spi;
/* */ }
/* */
/* */ public final String getMechanismType()
/* */ {
/* 255 */ return this.mechanism;
/* */ }
/* */
/* */ public final String getAlgorithm()
/* */ {
/* 265 */ return this.algorithm;
/* */ }
/* */
/* */ public final Provider getProvider()
/* */ {
/* 274 */ return this.provider;
/* */ }
/* */
/* */ public abstract void init(TransformParameterSpec paramTransformParameterSpec)
/* */ throws InvalidAlgorithmParameterException;
/* */
/* */ public abstract void marshalParams(XMLStructure paramXMLStructure, XMLCryptoContext paramXMLCryptoContext)
/* */ throws MarshalException;
/* */
/* */ public abstract void init(XMLStructure paramXMLStructure, XMLCryptoContext paramXMLCryptoContext)
/* */ throws InvalidAlgorithmParameterException;
/* */
/* */ private static class MechanismMapEntry
/* */ implements Map.Entry
/* */ {
/* */ private final String mechanism;
/* */ private final String algorithm;
/* */ private final String key;
/* */
/* */ MechanismMapEntry(String algorithm, String mechanism)
/* */ {
/* 220 */ this.algorithm = algorithm;
/* 221 */ this.mechanism = mechanism;
/* 222 */ this.key = ("TransformService." + algorithm + " MechanismType");
/* */ }
/* */ public boolean equals(Object o) {
/* 225 */ if (!(o instanceof Map.Entry)) {
/* 226 */ return false;
/* */ }
/* 228 */ Map.Entry e = (Map.Entry)o;
/* 229 */ return (getKey() == null ? e.getKey() == null : getKey().equals(e.getKey())) && (getValue() == null ? e.getValue() == null : getValue().equals(e.getValue()));
/* */ }
/* */
/* */ public Object getKey()
/* */ {
/* 235 */ return this.key;
/* */ }
/* */ public Object getValue() {
/* 238 */ return this.mechanism;
/* */ }
/* */ public Object setValue(Object value) {
/* 241 */ throw new UnsupportedOperationException();
/* */ }
/* */ public int hashCode() {
/* 244 */ return (getKey() == null ? 0 : getKey().hashCode()) ^ (getValue() == null ? 0 : getValue().hashCode());
/* */ }
/* */ }
/* */ }
/* Location: E:\HYN\Java\trunk\ref\lib-dep\xmldsig\xmldsig.jar
* Qualified Name: javax.xml.crypto.dsig.TransformService
* JD-Core Version: 0.6.2
*/