Class SignatureAlgorithm
- java.lang.Object
-
- org.apache.xml.security.utils.ElementProxy
-
- org.apache.xml.security.algorithms.Algorithm
-
- org.apache.xml.security.algorithms.SignatureAlgorithm
-
public class SignatureAlgorithm extends Algorithm
Allows selection of digital signature's algorithm, private keys, other security parameters, and algorithm's ID.- Author:
- Christian Geuer-Pollmann
-
-
Field Summary
Fields Modifier and Type Field Description protected SignatureAlgorithmSpi_signatureAlgorithmField _signatureAlgorithm-
Fields inherited from class org.apache.xml.security.utils.ElementProxy
_baseURI, _constructionElement, _doc, _state, MODE_CREATE, MODE_DECRYPT, MODE_ENCRYPT, MODE_PROCESS, MODE_SIGN, MODE_UNKNOWN, MODE_VERIFY
-
-
Constructor Summary
Constructors Constructor Description SignatureAlgorithm(org.w3c.dom.Document doc, java.lang.String algorithmURI)Constructor SignatureAlgorithmSignatureAlgorithm(org.w3c.dom.Document doc, java.lang.String algorithmURI, int HMACOutputLength)Constructor SignatureAlgorithmSignatureAlgorithm(org.w3c.dom.Element element, java.lang.String BaseURI)Constructor SignatureAlgorithm
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBaseLocalName()Method getBaseLocalNamejava.lang.StringgetBaseNamespace()Method getBaseNamespacejava.lang.StringgetJCEAlgorithmString()Proxy method forSignature.getAlgorithm()which is executed on the internalSignatureobject.java.lang.StringgetJCEProviderName()Method getJCEProviderNamejava.lang.StringgetURI()Returns the URI representation of Transformation algorithmvoidinitSign(java.security.Key signingKey)Proxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.voidinitSign(java.security.Key signingKey, java.security.SecureRandom secureRandom)Proxy method forSignature.initSign(java.security.PrivateKey, java.security.SecureRandom)which is executed on the internalSignatureobject.voidinitSign(java.security.Key signingKey, java.security.spec.AlgorithmParameterSpec algorithmParameterSpec)Proxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.voidinitVerify(java.security.Key verificationKey)Proxy method forSignature.initVerify(java.security.PublicKey)which is executed on the internalSignatureobject.static voidproviderInit()Initalizes for thisTransformstatic voidregister(java.lang.String algorithmURI, java.lang.String implementingClass)Registers implementing class of the Transform algorithm with algorithmURIvoidsetParameter(java.security.spec.AlgorithmParameterSpec params)Proxy method forSignature.setParameter(java.security.spec.AlgorithmParameterSpec)which is executed on the internalSignatureobject.byte[]sign()Proxy method forSignature.sign()which is executed on the internalSignatureobject.voidupdate(byte input)Proxy method forSignature.update(byte)which is executed on the internalSignatureobject.voidupdate(byte[] input)Proxy method forSignature.update(byte[])which is executed on the internalSignatureobject.voidupdate(byte[] buf, int offset, int len)Proxy method forSignature.update(byte[], int, int)which is executed on the internalSignatureobject.booleanverify(byte[] signature)Proxy method forSignature.verify(byte[])which is executed on the internalSignatureobject.-
Methods inherited from class org.apache.xml.security.algorithms.Algorithm
getAlgorithmURI, setAlgorithmURI
-
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
-
-
-
-
Field Detail
-
_signatureAlgorithm
protected SignatureAlgorithmSpi _signatureAlgorithm
Field _signatureAlgorithm
-
-
Constructor Detail
-
SignatureAlgorithm
public SignatureAlgorithm(org.w3c.dom.Document doc, java.lang.String algorithmURI) throws XMLSecurityExceptionConstructor SignatureAlgorithm- Parameters:
doc-algorithmURI-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(org.w3c.dom.Document doc, java.lang.String algorithmURI, int HMACOutputLength) throws XMLSecurityExceptionConstructor SignatureAlgorithm- Parameters:
doc-algorithmURI-HMACOutputLength-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(org.w3c.dom.Element element, java.lang.String BaseURI) throws XMLSecurityExceptionConstructor SignatureAlgorithm- Parameters:
element-BaseURI-- Throws:
XMLSecurityException
-
-
Method Detail
-
sign
public byte[] sign() throws XMLSignatureExceptionProxy method forSignature.sign()which is executed on the internalSignatureobject.- Returns:
- the result of the
Signature.sign()method - Throws:
XMLSignatureException
-
getJCEAlgorithmString
public java.lang.String getJCEAlgorithmString()
Proxy method forSignature.getAlgorithm()which is executed on the internalSignatureobject.- Returns:
- the result of the
Signature.getAlgorithm()method
-
getJCEProviderName
public java.lang.String getJCEProviderName()
Method getJCEProviderName- Returns:
- The Provider of this Signature Alogrithm
-
update
public void update(byte[] input) throws XMLSignatureExceptionProxy method forSignature.update(byte[])which is executed on the internalSignatureobject.- Parameters:
input-- Throws:
XMLSignatureException
-
update
public void update(byte input) throws XMLSignatureExceptionProxy method forSignature.update(byte)which is executed on the internalSignatureobject.- Parameters:
input-- Throws:
XMLSignatureException
-
update
public void update(byte[] buf, int offset, int len) throws XMLSignatureExceptionProxy method forSignature.update(byte[], int, int)which is executed on the internalSignatureobject.- Parameters:
buf-offset-len-- Throws:
XMLSignatureException
-
initSign
public void initSign(java.security.Key signingKey) throws XMLSignatureExceptionProxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.- Parameters:
signingKey-- Throws:
XMLSignatureException
-
initSign
public void initSign(java.security.Key signingKey, java.security.SecureRandom secureRandom) throws XMLSignatureExceptionProxy method forSignature.initSign(java.security.PrivateKey, java.security.SecureRandom)which is executed on the internalSignatureobject.- Parameters:
signingKey-secureRandom-- Throws:
XMLSignatureException
-
initSign
public void initSign(java.security.Key signingKey, java.security.spec.AlgorithmParameterSpec algorithmParameterSpec) throws XMLSignatureExceptionProxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.- Parameters:
signingKey-algorithmParameterSpec-- Throws:
XMLSignatureException
-
setParameter
public void setParameter(java.security.spec.AlgorithmParameterSpec params) throws XMLSignatureExceptionProxy method forSignature.setParameter(java.security.spec.AlgorithmParameterSpec)which is executed on the internalSignatureobject.- Parameters:
params-- Throws:
XMLSignatureException
-
initVerify
public void initVerify(java.security.Key verificationKey) throws XMLSignatureExceptionProxy method forSignature.initVerify(java.security.PublicKey)which is executed on the internalSignatureobject.- Parameters:
verificationKey-- Throws:
XMLSignatureException
-
verify
public boolean verify(byte[] signature) throws XMLSignatureExceptionProxy method forSignature.verify(byte[])which is executed on the internalSignatureobject.- Parameters:
signature-- Returns:
- true if if the signature is valid.
- Throws:
XMLSignatureException
-
getURI
public final java.lang.String getURI()
Returns the URI representation of Transformation algorithm- Returns:
- the URI representation of Transformation algorithm
-
providerInit
public static void providerInit()
Initalizes for thisTransform
-
register
public static void register(java.lang.String algorithmURI, java.lang.String implementingClass) throws AlgorithmAlreadyRegisteredException, XMLSignatureExceptionRegisters implementing class of the Transform algorithm with algorithmURI- Parameters:
algorithmURI- algorithmURI URI representation ofTransform algorithm.implementingClass-implementingClassthe implementing class ofSignatureAlgorithmSpi- Throws:
AlgorithmAlreadyRegisteredException- if specified algorithmURI is already registeredXMLSignatureException
-
getBaseNamespace
public java.lang.String getBaseNamespace()
Method getBaseNamespace- Specified by:
getBaseNamespacein classElementProxy- Returns:
- URI of this element
-
getBaseLocalName
public java.lang.String getBaseLocalName()
Method getBaseLocalName- Specified by:
getBaseLocalNamein classElementProxy- Returns:
- Local name
-
-