Module org.apache.santuario.xmlsec
Class DOMSignatureMethod
java.lang.Object
org.apache.jcp.xml.dsig.internal.dom.DOMStructure
org.apache.jcp.xml.dsig.internal.dom.AbstractDOMSignatureMethod
org.apache.jcp.xml.dsig.internal.dom.DOMSignatureMethod
- All Implemented Interfaces:
AlgorithmMethod,SignatureMethod,XMLStructure
- Direct Known Subclasses:
DOMSignatureMethod.AbstractEDDSASignatureMethod,DOMSignatureMethod.AbstractP1363FormatSignatureMethod,DOMSignatureMethod.AbstractRSASignatureMethod
DOM-based abstract implementation of SignatureMethod.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class(package private) static class(package private) static classAbstract class to support signature algorithms that sign and verify signatures in the IEEE P1363 format.(package private) static class(package private) static class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final classNested classes/interfaces inherited from class org.apache.jcp.xml.dsig.internal.dom.AbstractDOMSignatureMethod
AbstractDOMSignatureMethod.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final Stringprivate static final System.Loggerprivate SignatureMethodParameterSpec(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final Stringprivate SignatureFields inherited from interface javax.xml.crypto.dsig.SignatureMethod
DSA_SHA1, HMAC_SHA1, HMAC_SHA224, HMAC_SHA256, HMAC_SHA384, HMAC_SHA512, RSA_SHA1, SHA1_RSA_MGF1, SHA224_RSA_MGF1, SHA256_RSA_MGF1, SHA384_RSA_MGF1, SHA512_RSA_MGF1 -
Constructor Summary
ConstructorsConstructorDescriptionCreates aDOMSignatureMethod.DOMSignatureMethod(Element smElem) Creates aDOMSignatureMethodfrom an element. -
Method Summary
Modifier and TypeMethodDescriptionfinal AlgorithmParameterSpec(package private) SignatureReturns an instance of Signature from the specified Provider.(package private) abstract byte[]postSignFormat(Key key, byte[] sig) Returns the signature bytes with any additional formatting necessary for the signature algorithm used.(package private) abstract byte[]preVerifyFormat(Key key, byte[] sig) Returns the signature bytes with any conversions that are necessary before the signature can be verified.(package private) byte[]sign(Key key, SignedInfo si, XMLSignContext context) Signs the bytes with the specified key, using the underlying Signature or Mac algorithm.(package private) static SignatureMethod(package private) booleanverify(Key key, SignedInfo si, byte[] sig, XMLValidateContext context) Verifies the passed-in signature with the specified key, using the underlying Signature or Mac algorithm.Methods inherited from class org.apache.jcp.xml.dsig.internal.dom.AbstractDOMSignatureMethod
checkParams, equals, getAlgorithmType, getJCAAlgorithm, hashCode, marshal, marshalParams, paramsEqual, unmarshalParamsMethods inherited from class org.apache.jcp.xml.dsig.internal.dom.DOMStructure
equalsContent, isFeatureSupportedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.xml.crypto.AlgorithmMethod
getAlgorithmMethods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
-
Field Details
-
DOM_SIGNATURE_PROVIDER
- See Also:
-
LOG
-
params
-
signature
-
RSA_SHA224
- See Also:
-
RSA_SHA256
- See Also:
-
RSA_SHA384
- See Also:
-
RSA_SHA512
- See Also:
-
RSA_RIPEMD160
- See Also:
-
ECDSA_SHA1
- See Also:
-
ECDSA_SHA224
- See Also:
-
ECDSA_SHA256
- See Also:
-
ECDSA_SHA384
- See Also:
-
ECDSA_SHA512
- See Also:
-
DSA_SHA256
- See Also:
-
ED25519
- See Also:
-
ED448
- See Also:
-
ECDSA_SHA3_224
- See Also:
-
ECDSA_SHA3_256
- See Also:
-
ECDSA_SHA3_384
- See Also:
-
ECDSA_SHA3_512
- See Also:
-
ECDSA_RIPEMD160
- See Also:
-
RSA_SHA1_MGF1
- See Also:
-
RSA_SHA224_MGF1
- See Also:
-
RSA_SHA256_MGF1
- See Also:
-
RSA_SHA384_MGF1
- See Also:
-
RSA_SHA512_MGF1
- See Also:
-
RSA_RIPEMD160_MGF1
- See Also:
-
RSA_SHA3_224_MGF1
- See Also:
-
RSA_SHA3_256_MGF1
- See Also:
-
RSA_SHA3_384_MGF1
- See Also:
-
RSA_SHA3_512_MGF1
- See Also:
-
-
Constructor Details
-
DOMSignatureMethod
DOMSignatureMethod(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException Creates aDOMSignatureMethod.- Parameters:
params- the algorithm-specific params (may benull)- Throws:
InvalidAlgorithmParameterException- if the parameters are not appropriate for this signature method
-
DOMSignatureMethod
DOMSignatureMethod(Element smElem) throws MarshalException Creates aDOMSignatureMethodfrom an element. This ctor invokes theunmarshalParamsmethod to unmarshal any algorithm-specific input parameters.- Parameters:
smElem- a SignatureMethod element- Throws:
MarshalException
-
-
Method Details
-
postSignFormat
Returns the signature bytes with any additional formatting necessary for the signature algorithm used. For RSA signatures, no changes are required, and this method should simply return backsig. For DSA and ECDSA, this method should return the signature in the IEEE P1363 format, the concatenation of r and s.- Parameters:
key- the key used to signsig- the signature returned bySignature.sign()- Returns:
- the formatted signature
- Throws:
IOException
-
preVerifyFormat
Returns the signature bytes with any conversions that are necessary before the signature can be verified. For RSA signatures, no changes are required, and this method should simply return backsig. For DSA and ECDSA, this method should return the signature in the DER-encoded ASN.1 format.- Parameters:
key- the key used to signsig- the signature- Returns:
- the formatted signature
- Throws:
IOException
-
unmarshal
- Throws:
MarshalException
-
getParameterSpec
-
getSignature
Returns an instance of Signature from the specified Provider. The algorithm is specified by thegetJCAAlgorithm()method.- Parameters:
p- the Provider to use- Returns:
- an instance of Signature implementing the algorithm
specified by
getJCAAlgorithm() - Throws:
NoSuchAlgorithmException- if the Provider does not support the signature algorithm
-
verify
boolean verify(Key key, SignedInfo si, byte[] sig, XMLValidateContext context) throws InvalidKeyException, SignatureException, XMLSignatureException Description copied from class:AbstractDOMSignatureMethodVerifies the passed-in signature with the specified key, using the underlying Signature or Mac algorithm.- Specified by:
verifyin classAbstractDOMSignatureMethod- Parameters:
key- the verification keysi- the SignedInfosig- the signature bytes to be verifiedcontext- the XMLValidateContext- Returns:
trueif the signature verified successfully,falseif not- Throws:
InvalidKeyException- if the key is improperly encoded, of the wrong type, or parameters are missing, etcSignatureException- if an unexpected error occurs, such as the passed in signature is improperly encodedXMLSignatureException- if an unexpected error occurs
-
sign
byte[] sign(Key key, SignedInfo si, XMLSignContext context) throws InvalidKeyException, XMLSignatureException Description copied from class:AbstractDOMSignatureMethodSigns the bytes with the specified key, using the underlying Signature or Mac algorithm.- Specified by:
signin classAbstractDOMSignatureMethod- Parameters:
key- the signing keysi- the SignedInfocontext- the XMLSignContext- Returns:
- the signature
- Throws:
InvalidKeyException- if the key is improperly encoded, of the wrong type, or parameters are missing, etcXMLSignatureException- if an unexpected error occurs
-