Class XMLSigningUtil

java.lang.Object
org.opensaml.xmlsec.crypto.XMLSigningUtil

public final class XMLSigningUtil extends Object
A utility class for computing and verifying raw signatures and MAC values.
  • 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 key
      algorithmURI - the algorithm URI to use
      input - 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 key
      algorithmURI - the algorithm URI to use
      signature - the computed signature value received from the signer
      input - 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