Class SignatureAlgorithm
java.lang.Object
org.apache.xml.security.utils.ElementProxy
org.apache.xml.security.utils.SignatureElementProxy
org.apache.xml.security.algorithms.Algorithm
org.apache.xml.security.algorithms.SignatureAlgorithm
Allows selection of digital signature's algorithm, private keys, other
security parameters, and algorithm's ID.
-
Field Summary
Fields inherited from class org.apache.xml.security.utils.ElementProxy
baseURI
-
Constructor Summary
ConstructorsConstructorDescriptionSignatureAlgorithm
(Document doc, String algorithmURI) Constructor SignatureAlgorithmSignatureAlgorithm
(Document doc, String algorithmURI, int hmacOutputLength) Constructor SignatureAlgorithmSignatureAlgorithm
(Element element, String baseURI) Constructor SignatureAlgorithmSignatureAlgorithm
(Element element, String baseURI, boolean secureValidation) Constructor SignatureAlgorithm -
Method Summary
Modifier and TypeMethodDescriptionMethod getBaseLocalNameMethod getBaseNamespaceProxy method forSignature.getAlgorithm()
which is executed on the internalSignature
object.Method getJCEProviderNamefinal String
getURI()
Returns the URI representation of Transformation algorithmvoid
Proxy method forSignature.initSign(java.security.PrivateKey)
which is executed on the internalSignature
object.void
initSign
(Key signingKey, SecureRandom secureRandom) Proxy method forSignature.initSign(java.security.PrivateKey, java.security.SecureRandom)
which is executed on the internalSignature
object.void
initSign
(Key signingKey, AlgorithmParameterSpec algorithmParameterSpec) Proxy method forSignature.initSign(java.security.PrivateKey)
which is executed on the internalSignature
object.void
initVerify
(Key verificationKey) Proxy method forSignature.initVerify(java.security.PublicKey)
which is executed on the internalSignature
object.static void
register
(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass) Registers implementing class of the SignatureAlgorithm with algorithmURIstatic void
Registers implementing class of the SignatureAlgorithm with algorithmURIstatic void
This method registers the default algorithms.void
setParameter
(AlgorithmParameterSpec params) Proxy method forSignature.setParameter(java.security.spec.AlgorithmParameterSpec)
which is executed on the internalSignature
object.byte[]
sign()
Proxy method forSignature.sign()
which is executed on the internalSignature
object.void
update
(byte input) Proxy method forSignature.update(byte)
which is executed on the internalSignature
object.void
update
(byte[] input) Proxy method forSignature.update(byte[])
which is executed on the internalSignature
object.void
update
(byte[] buf, int offset, int len) Proxy method forSignature.update(byte[], int, int)
which is executed on the internalSignature
object.boolean
verify
(byte[] signature) Proxy method forSignature.verify(byte[])
which is executed on the internalSignature
object.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, addReturnToSelf, addText, addTextElement, appendOther, appendSelf, appendSelf, createElementForFamily, createElementForFamilyLocal, createText, getBaseURI, getBigIntegerFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getFirstChild, getLocalAttribute, getTextFromChildElement, getTextFromTextChild, length, registerDefaultPrefixes, setDefaultPrefix, setDocument, setElement, setElement, setLocalAttribute, setLocalIdAttribute, setXPathNamespaceContext
-
Constructor Details
-
SignatureAlgorithm
Constructor SignatureAlgorithm- Parameters:
doc
-algorithmURI
-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Document doc, String algorithmURI, int hmacOutputLength) throws XMLSecurityException Constructor SignatureAlgorithm- Parameters:
doc
-algorithmURI
-hmacOutputLength
-- Throws:
XMLSecurityException
-
SignatureAlgorithm
Constructor SignatureAlgorithm- Parameters:
element
-baseURI
-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Element element, String baseURI, boolean secureValidation) throws XMLSecurityException Constructor SignatureAlgorithm- Parameters:
element
-baseURI
-secureValidation
-- Throws:
XMLSecurityException
-
-
Method Details
-
sign
Proxy method forSignature.sign()
which is executed on the internalSignature
object.- Returns:
- the result of the
Signature.sign()
method - Throws:
XMLSignatureException
-
getJCEAlgorithmString
Proxy method forSignature.getAlgorithm()
which is executed on the internalSignature
object.- Returns:
- the result of the
Signature.getAlgorithm()
method
-
getJCEProviderName
Method getJCEProviderName- Returns:
- The Provider of this Signature Algorithm
-
update
Proxy method forSignature.update(byte[])
which is executed on the internalSignature
object.- Parameters:
input
-- Throws:
XMLSignatureException
-
update
Proxy method forSignature.update(byte)
which is executed on the internalSignature
object.- Parameters:
input
-- Throws:
XMLSignatureException
-
update
Proxy method forSignature.update(byte[], int, int)
which is executed on the internalSignature
object.- Parameters:
buf
-offset
-len
-- Throws:
XMLSignatureException
-
initSign
Proxy method forSignature.initSign(java.security.PrivateKey)
which is executed on the internalSignature
object.- Parameters:
signingKey
-- Throws:
XMLSignatureException
-
initSign
Proxy method forSignature.initSign(java.security.PrivateKey, java.security.SecureRandom)
which is executed on the internalSignature
object.- Parameters:
signingKey
-secureRandom
-- Throws:
XMLSignatureException
-
initSign
public void initSign(Key signingKey, AlgorithmParameterSpec algorithmParameterSpec) throws XMLSignatureException Proxy method forSignature.initSign(java.security.PrivateKey)
which is executed on the internalSignature
object.- Parameters:
signingKey
-algorithmParameterSpec
-- Throws:
XMLSignatureException
-
setParameter
Proxy method forSignature.setParameter(java.security.spec.AlgorithmParameterSpec)
which is executed on the internalSignature
object.- Parameters:
params
-- Throws:
XMLSignatureException
-
initVerify
Proxy method forSignature.initVerify(java.security.PublicKey)
which is executed on the internalSignature
object.- Parameters:
verificationKey
-- Throws:
XMLSignatureException
-
verify
Proxy method forSignature.verify(byte[])
which is executed on the internalSignature
object.- Parameters:
signature
-- Returns:
- true if the signature is valid.
- Throws:
XMLSignatureException
-
getURI
Returns the URI representation of Transformation algorithm- Returns:
- the URI representation of Transformation algorithm
-
register
public static void register(String algorithmURI, String implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException, XMLSignatureException Registers implementing class of the SignatureAlgorithm with algorithmURI- Parameters:
algorithmURI
- algorithmURI URI representation ofSignatureAlgorithm
.implementingClass
-implementingClass
the implementing class ofSignatureAlgorithmSpi
- Throws:
AlgorithmAlreadyRegisteredException
- if specified algorithmURI is already registeredXMLSignatureException
SecurityException
- if a security manager is installed and the caller does not have permission to register the signature algorithmClassNotFoundException
-
register
public static void register(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException, XMLSignatureException Registers implementing class of the SignatureAlgorithm with algorithmURI- Parameters:
algorithmURI
- algorithmURI URI representation ofSignatureAlgorithm
.implementingClass
-implementingClass
the implementing class ofSignatureAlgorithmSpi
- Throws:
AlgorithmAlreadyRegisteredException
- if specified algorithmURI is already registeredXMLSignatureException
SecurityException
- if a security manager is installed and the caller does not have permission to register the signature algorithmClassNotFoundException
-
registerDefaultAlgorithms
public static void registerDefaultAlgorithms()This method registers the default algorithms. -
getBaseNamespace
Method getBaseNamespace- Overrides:
getBaseNamespace
in classSignatureElementProxy
- Returns:
- URI of this element
-
getBaseLocalName
Method getBaseLocalName- Specified by:
getBaseLocalName
in classElementProxy
- Returns:
- Local name
-