Module org.apache.santuario.xmlsec
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
-
public class SignatureAlgorithm extends Algorithm
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
Constructors Constructor Description SignatureAlgorithm(Document doc, String algorithmURI)Constructor SignatureAlgorithmSignatureAlgorithm(Document doc, String algorithmURI, int hmacOutputLength)Constructor SignatureAlgorithmSignatureAlgorithm(Document doc, String algorithmURI, int hmacOutputLength, Provider provider)SignatureAlgorithm(Document doc, String algorithmURI, Provider provider)SignatureAlgorithm(Document doc, String algorithmURI, Provider provider, AlgorithmParameterSpec parameterSpec)SignatureAlgorithm(Element element, String baseURI)Constructor SignatureAlgorithmSignatureAlgorithm(Element element, String baseURI, boolean secureValidation)Constructor SignatureAlgorithmSignatureAlgorithm(Element element, String baseURI, boolean secureValidation, Provider provider)SignatureAlgorithm(Element element, String baseURI, Provider provider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetBaseLocalName()Method getBaseLocalNameStringgetBaseNamespace()Method getBaseNamespaceStringgetJCEAlgorithmString()Proxy method forSignature.getAlgorithm()which is executed on the internalSignatureobject.StringgetJCEProviderName()Method getJCEProviderNameStringgetURI()Returns the URI representation of Transformation algorithmvoidinitSign(Key signingKey)Proxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.voidinitSign(Key signingKey, SecureRandom secureRandom)Proxy method forSignature.initSign(java.security.PrivateKey, java.security.SecureRandom)which is executed on the internalSignatureobject.voidinitSign(Key signingKey, AlgorithmParameterSpec algorithmParameterSpec)Proxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.voidinitVerify(Key verificationKey)Proxy method forSignature.initVerify(java.security.PublicKey)which is executed on the internalSignatureobject.static voidregister(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass)Registers implementing class of the SignatureAlgorithm with algorithmURIstatic voidregister(String algorithmURI, String implementingClass)Registers implementing class of the SignatureAlgorithm with algorithmURIstatic voidregisterDefaultAlgorithms()This method registers the default algorithms.voidsetParameter(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, 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 Detail
-
SignatureAlgorithm
public SignatureAlgorithm(Document doc, String algorithmURI) throws XMLSecurityException
Constructor SignatureAlgorithm- Parameters:
doc-algorithmURI-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Document doc, String algorithmURI, Provider provider) throws XMLSecurityException
- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Document doc, String algorithmURI, Provider provider, AlgorithmParameterSpec parameterSpec) throws XMLSecurityException
- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Document doc, String algorithmURI, int hmacOutputLength) throws XMLSecurityException
Constructor SignatureAlgorithm- Parameters:
doc-algorithmURI-hmacOutputLength-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Document doc, String algorithmURI, int hmacOutputLength, Provider provider) throws XMLSecurityException
- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Element element, String baseURI) throws XMLSecurityException
Constructor SignatureAlgorithm- Parameters:
element-baseURI-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Element element, String baseURI, Provider provider) throws XMLSecurityException
- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Element element, String baseURI, boolean secureValidation) throws XMLSecurityException
Constructor SignatureAlgorithm- Parameters:
element-baseURI-secureValidation-- Throws:
XMLSecurityException
-
SignatureAlgorithm
public SignatureAlgorithm(Element element, String baseURI, boolean secureValidation, Provider provider) throws XMLSecurityException
- 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 String getJCEAlgorithmString()
Proxy method forSignature.getAlgorithm()which is executed on the internalSignatureobject.- Returns:
- the result of the
Signature.getAlgorithm()method
-
getJCEProviderName
public String getJCEProviderName()
Method getJCEProviderName- Returns:
- The Provider of this Signature Algorithm
-
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(Key signingKey) throws XMLSignatureException
Proxy method forSignature.initSign(java.security.PrivateKey)which is executed on the internalSignatureobject.- Parameters:
signingKey-- Throws:
XMLSignatureException
-
initSign
public void initSign(Key signingKey, SecureRandom secureRandom) throws XMLSignatureException
Proxy method forSignature.initSign(java.security.PrivateKey, java.security.SecureRandom)which is executed on the internalSignatureobject.- 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 internalSignatureobject.- Parameters:
signingKey-algorithmParameterSpec-- Throws:
XMLSignatureException
-
setParameter
public void setParameter(AlgorithmParameterSpec params) throws XMLSignatureException
Proxy method forSignature.setParameter( java.security.spec.AlgorithmParameterSpec)which is executed on the internalSignatureobject.- Parameters:
params-- Throws:
XMLSignatureException
-
initVerify
public void initVerify(Key verificationKey) throws XMLSignatureException
Proxy 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 the signature is valid.
- Throws:
XMLSignatureException
-
getURI
public final String 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-implementingClassthe implementing class ofSignatureAlgorithmSpi- Throws:
AlgorithmAlreadyRegisteredException- if specified algorithmURI is already registeredXMLSignatureExceptionSecurityException- 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-implementingClassthe implementing class ofSignatureAlgorithmSpi- Throws:
AlgorithmAlreadyRegisteredException- if specified algorithmURI is already registeredXMLSignatureExceptionSecurityException- 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
public String getBaseNamespace()
Method getBaseNamespace- Overrides:
getBaseNamespacein classSignatureElementProxy- Returns:
- URI of this element
-
getBaseLocalName
public String getBaseLocalName()
Method getBaseLocalName- Specified by:
getBaseLocalNamein classElementProxy- Returns:
- Local name
-
-