Module org.apache.santuario.xmlsec
Class DOMRSAPSSSignatureMethod
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.DOMRSAPSSSignatureMethod
- All Implemented Interfaces:
AlgorithmMethod,SignatureMethod,XMLStructure
- Direct Known Subclasses:
DOMRSAPSSSignatureMethod.RSAPSS
DOM-based abstract implementation of SignatureMethod for RSA-PSS.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(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 Stringprivate static final Stringprivate static final System.Loggerprivate final SignatureMethodParameterSpec(package private) static final Stringprivate intprivate Signatureprivate intFields inherited from interface javax.xml.crypto.dsig.SignatureMethod
DSA_SHA1, DSA_SHA256, ECDSA_SHA1, ECDSA_SHA224, ECDSA_SHA256, ECDSA_SHA384, ECDSA_SHA512, HMAC_SHA1, HMAC_SHA224, HMAC_SHA256, HMAC_SHA384, HMAC_SHA512, RSA_SHA1, RSA_SHA224, RSA_SHA256, RSA_SHA384, RSA_SHA512, SHA1_RSA_MGF1, SHA224_RSA_MGF1, SHA256_RSA_MGF1, SHA384_RSA_MGF1, SHA512_RSA_MGF1 -
Constructor Summary
ConstructorsConstructorDescriptionCreates aDOMSignatureMethod.DOMRSAPSSSignatureMethod(Element smElem) Creates aDOMSignatureMethodfrom an element. -
Method Summary
Modifier and TypeMethodDescription(package private) voidChecks if the specified parameters are valid for this algorithm.private SignatureMethodParameterSpecfinal AlgorithmParameterSpec(package private) voidmarshalParams(Element parent, String prefix) Marshals the algorithm-specific parameters to an Element and appends it to the specified parent element.(package private) booleanReturns true if parameters are equal; false otherwise.(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) SignatureMethodParameterSpecunmarshalParams(Element paramsElem) UnmarshalsSignatureMethodParameterSpecfrom the specifiedElement.(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
equals, getAlgorithmType, getJCAAlgorithm, hashCode, marshalMethods 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_PSS
- See Also:
-
trailerField
private int trailerField -
saltLength
private int saltLength -
digestName
-
-
Constructor Details
-
DOMRSAPSSSignatureMethod
DOMRSAPSSSignatureMethod(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
-
DOMRSAPSSSignatureMethod
DOMRSAPSSSignatureMethod(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
-
checkParams
Description copied from class:AbstractDOMSignatureMethodChecks if the specified parameters are valid for this algorithm. By default, this method throws an exception if parameters are specified since most SignatureMethod algorithms do not have parameters. Subclasses should override it if they have parameters.- Overrides:
checkParamsin classAbstractDOMSignatureMethod- Parameters:
params- the algorithm-specific params (may benull)- Throws:
InvalidAlgorithmParameterException- if the parameters are not appropriate for this signature method
-
getParameterSpec
-
marshalParams
Description copied from class:AbstractDOMSignatureMethodMarshals the algorithm-specific parameters to an Element and appends it to the specified parent element. By default, this method throws an exception since most SignatureMethod algorithms do not have parameters. Subclasses should override it if they have parameters.- Overrides:
marshalParamsin classAbstractDOMSignatureMethod- Parameters:
parent- the parent element to append the parameters toprefix- the algorithm parameters prefix to use- Throws:
MarshalException- if the parameters cannot be marshalled
-
unmarshalParams
Description copied from class:AbstractDOMSignatureMethodUnmarshalsSignatureMethodParameterSpecfrom the specifiedElement. By default, this method throws an exception since most SignatureMethod algorithms do not have parameters. Subclasses should override it if they have parameters.- Overrides:
unmarshalParamsin classAbstractDOMSignatureMethod- Parameters:
paramsElem- theElementholding the input params- Returns:
- the algorithm-specific
SignatureMethodParameterSpec - Throws:
MarshalException- if the parameters cannot be unmarshalled
-
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
-
paramsEqual
Description copied from class:AbstractDOMSignatureMethodReturns true if parameters are equal; false otherwise. Subclasses should override this method to compare algorithm-specific parameters.- Overrides:
paramsEqualin classAbstractDOMSignatureMethod
-
getDefaultParameterSpec
-