SignatureAlgorithmpublic class SignatureAlgorithm extends Algorithm Allows selection of digital signature's algorithm, private keys, other security parameters, and algorithm's ID. |
Fields Summary |
---|
static Logger | log{@link java.util.logging} logging facility | static boolean | _alreadyInitializedField _alreadyInitialized | static HashMap | _algorithmHashAll available algorithm classes are registered here | protected SignatureAlgorithmSpi | _signatureAlgorithmField _signatureAlgorithm |
Constructors Summary |
---|
public SignatureAlgorithm(Document doc, String algorithmURI)Constructor SignatureAlgorithm
super(doc, algorithmURI);
try {
Class implementingClass =
SignatureAlgorithm.getImplementingClass(algorithmURI);
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+ implementingClass + "\"");
this._signatureAlgorithm =
(SignatureAlgorithmSpi) implementingClass.newInstance();
} catch (IllegalAccessException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
} catch (InstantiationException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
} catch (NullPointerException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
}
| public SignatureAlgorithm(Document doc, String algorithmURI, int HMACOutputLength)Constructor SignatureAlgorithm
this(doc, algorithmURI);
this._signatureAlgorithm.engineSetHMACOutputLength(HMACOutputLength);
((IntegrityHmac)this._signatureAlgorithm)
.engineAddContextToElement(this._constructionElement);
| public SignatureAlgorithm(Element element, String BaseURI)Constructor SignatureAlgorithm
super(element, BaseURI);
String algorithmURI = this.getURI();
try {
Class implementingClass =
SignatureAlgorithm.getImplementingClass(algorithmURI);
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
+ implementingClass + "\"");
this._signatureAlgorithm =
(SignatureAlgorithmSpi) implementingClass.newInstance();
this._signatureAlgorithm
.engineGetContextFromElement(this._constructionElement);
} catch (IllegalAccessException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
} catch (InstantiationException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
} catch (NullPointerException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
}
|
Methods Summary |
---|
public java.lang.String | getBaseLocalName()Method getBaseLocalName
return Constants._TAG_SIGNATUREMETHOD;
| public java.lang.String | getBaseNamespace()Method getBaseNamespace
return Constants.SignatureSpecNS;
| private static java.lang.Class | getImplementingClass(java.lang.String URI)Method getImplementingClass
if (SignatureAlgorithm._algorithmHash == null) {
return null;
}
return (Class) SignatureAlgorithm._algorithmHash.get(URI);
| public java.lang.String | getJCEAlgorithmString()Proxy method for {@link java.security.Signature#getAlgorithm}
which is executed on the internal {@link java.security.Signature} object.
return this._signatureAlgorithm.engineGetJCEAlgorithmString();
| public java.lang.String | getJCEProviderName()Method getJCEProviderName
return this._signatureAlgorithm.engineGetJCEProviderName();
| public final java.lang.String | getURI()Returns the URI representation of Transformation algorithm
return this._constructionElement.getAttributeNS(null,
Constants._ATT_ALGORITHM);
| public void | initSign(java.security.Key signingKey)Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineInitSign(signingKey);
| public void | initSign(java.security.Key signingKey, java.security.SecureRandom secureRandom)Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey, java.security.SecureRandom)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineInitSign(signingKey, secureRandom);
| public void | initSign(java.security.Key signingKey, java.security.spec.AlgorithmParameterSpec algorithmParameterSpec)Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineInitSign(signingKey,
algorithmParameterSpec);
| public void | initVerify(java.security.Key verificationKey)Proxy method for {@link java.security.Signature#initVerify(java.security.PublicKey)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineInitVerify(verificationKey);
| public static void | providerInit()Initalizes for this {@link com.sun.org.apache.xml.internal.security.transforms.Transform}
if (SignatureAlgorithm.log == null) {
SignatureAlgorithm.log =
java.util.logging.Logger
.getLogger(SignatureAlgorithm.class.getName());
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Init() called");
if (!SignatureAlgorithm._alreadyInitialized) {
SignatureAlgorithm._algorithmHash = new HashMap(10);
SignatureAlgorithm._alreadyInitialized = true;
}
| public static void | register(java.lang.String algorithmURI, java.lang.String implementingClass)Registers implementing class of the Transform algorithm with algorithmURI
{
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
// are we already registered?
Class registeredClassClass =
SignatureAlgorithm.getImplementingClass(algorithmURI);
if (registeredClassClass!=null) {
String registeredClass = registeredClassClass.getName();
if ((registeredClass != null) && (registeredClass.length() != 0)) {
Object exArgs[] = { algorithmURI, registeredClass };
throw new AlgorithmAlreadyRegisteredException(
"algorithm.alreadyRegistered", exArgs);
}
}
try {
SignatureAlgorithm._algorithmHash.put(algorithmURI, Class.forName(implementingClass));
} catch (ClassNotFoundException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
} catch (NullPointerException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
ex);
}
}
| public void | setParameter(java.security.spec.AlgorithmParameterSpec params)Proxy method for {@link java.security.Signature#setParameter(java.security.spec.AlgorithmParameterSpec)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineSetParameter(params);
| public byte[] | sign()Proxy method for {@link java.security.Signature#sign()}
which is executed on the internal {@link java.security.Signature} object.
return this._signatureAlgorithm.engineSign();
| public void | update(byte[] input)Proxy method for {@link java.security.Signature#update(byte[])}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineUpdate(input);
| public void | update(byte input)Proxy method for {@link java.security.Signature#update(byte)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineUpdate(input);
| public void | update(byte[] buf, int offset, int len)Proxy method for {@link java.security.Signature#update(byte[], int, int)}
which is executed on the internal {@link java.security.Signature} object.
this._signatureAlgorithm.engineUpdate(buf, offset, len);
| public boolean | verify(byte[] signature)Proxy method for {@link java.security.Signature#verify(byte[])}
which is executed on the internal {@link java.security.Signature} object.
return this._signatureAlgorithm.engineVerify(signature);
|
|