Package org.opensaml.xmlsec.crypto
Class XMLSigningUtil
java.lang.Object
org.opensaml.xmlsec.crypto.XMLSigningUtil
A utility class for computing and verifying raw signatures and MAC values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]signWithURI(Credential signingCredential, String algorithmURI, byte[] input) Compute the signature or MAC value over the supplied input.static booleanverifyWithURI(Credential verificationCredential, String algorithmURI, byte[] signature, byte[] input) Verify the signature value computed over the supplied input against the supplied signature value.
-
Constructor Details
-
XMLSigningUtil
private XMLSigningUtil()Constructor.
-
-
Method Details
-
signWithURI
@Nonnull public static byte[] signWithURI(@Nonnull Credential signingCredential, @Nonnull String algorithmURI, @Nonnull byte[] input) throws SecurityException Compute the signature or MAC value over the supplied input. It is up to the caller to ensure that the specified algorithm URI is consistent with the type of signing key supplied in the signing credential.- Parameters:
signingCredential- the credential containing the signing keyalgorithmURI- the algorithm URI to useinput- the input over which to compute the signature- Returns:
- the computed signature or MAC value
- Throws:
SecurityException- throw if the computation process results in an error
-
verifyWithURI
public static boolean verifyWithURI(@Nonnull Credential verificationCredential, @Nonnull String algorithmURI, @Nonnull byte[] signature, @Nonnull byte[] input) throws SecurityException Verify the signature value computed over the supplied input against the supplied signature value. It is up to the caller to ensure that the specified algorithm URI are consistent with the type of verification credential supplied.- Parameters:
verificationCredential- the credential containing the verification keyalgorithmURI- the algorithm URI to usesignature- the computed signature value received from the signerinput- the input over which the signature is computed and verified- Returns:
- true if the signature value computed over the input using the supplied key and algorithm ID is identical to the supplied signature value
- Throws:
SecurityException- thrown if the signature computation or verification process results in an error
-