public final class SigningUtil extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
sign(Credential signingCredential,
String jcaAlgorithmID,
boolean isMAC,
byte[] input)
Compute the signature or MAC value over the supplied input.
|
static byte[] |
sign(PrivateKey signingKey,
String jcaAlgorithmID,
byte[] input)
Compute the raw signature value over the supplied input.
|
static byte[] |
signMAC(Key signingKey,
String jcaAlgorithmID,
byte[] input)
Compute the Message Authentication Code (MAC) value over the supplied input.
|
static boolean |
verify(Credential verificationCredential,
String jcaAlgorithmID,
boolean isMAC,
byte[] signature,
byte[] input)
Verify the signature value computed over the supplied input against the supplied signature value.
|
static boolean |
verify(PublicKey verificationKey,
String jcaAlgorithmID,
byte[] signature,
byte[] input)
Verify the signature value computed over the supplied input against the supplied signature value.
|
static boolean |
verifyMAC(Key verificationKey,
String jcaAlgorithmID,
byte[] signature,
byte[] input)
Verify the Message Authentication Code (MAC) value computed over the supplied input against the supplied MAC
value.
|
@Nonnull public static byte[] sign(@Nonnull Credential signingCredential, @Nonnull String jcaAlgorithmID, boolean isMAC, @Nonnull byte[] input) throws SecurityException
signingCredential
- the credential containing the signing keyjcaAlgorithmID
- the Java JCA algorithm ID to useisMAC
- flag indicating whether the operation to be performed is a signature or MAC computationinput
- the input over which to compute the signatureSecurityException
- throw if the computation process results in an error@Nonnull public static byte[] sign(@Nonnull PrivateKey signingKey, @Nonnull String jcaAlgorithmID, @Nonnull byte[] input) throws SecurityException
signingKey
- the private key with which to compute the signaturejcaAlgorithmID
- the Java JCA algorithm ID to useinput
- the input over which to compute the signatureSecurityException
- thrown if the signature computation results in an error@Nonnull public static byte[] signMAC(@Nonnull Key signingKey, @Nonnull String jcaAlgorithmID, @Nonnull byte[] input) throws SecurityException
signingKey
- the key with which to compute the MACjcaAlgorithmID
- the Java JCA algorithm ID to useinput
- the input over which to compute the MACSecurityException
- thrown if the MAC computation results in an errorpublic static boolean verify(@Nonnull Credential verificationCredential, @Nonnull String jcaAlgorithmID, boolean isMAC, @Nonnull byte[] signature, @Nonnull byte[] input) throws SecurityException
verificationCredential
- the credential containing the verification keyjcaAlgorithmID
- the Java JCA algorithm ID to useisMAC
- flag indicating whether the operation to be performed is a signature or MAC computationsignature
- the computed signature value received from the signerinput
- the input over which the signature is computed and verifiedSecurityException
- thrown if the signature computation or verification process results in an errorpublic static boolean verify(@Nonnull PublicKey verificationKey, @Nonnull String jcaAlgorithmID, @Nonnull byte[] signature, @Nonnull byte[] input) throws SecurityException
verificationKey
- the key with which to compute and verify the signaturejcaAlgorithmID
- the Java JCA algorithm ID to usesignature
- the computed signature value received from the signerinput
- the input over which the signature is computed and verifiedSecurityException
- thrown if the signature computation or verification process results in an errorpublic static boolean verifyMAC(@Nonnull Key verificationKey, @Nonnull String jcaAlgorithmID, @Nonnull byte[] signature, @Nonnull byte[] input) throws SecurityException
verificationKey
- the key with which to compute and verify the MACjcaAlgorithmID
- the Java JCA algorithm ID to usesignature
- the computed MAC value received from the signerinput
- the input over which the MAC is computed and verifiedSecurityException
- thrown if the MAC computation or verification process results in an errorCopyright © 2016 JBoss by Red Hat. All rights reserved.