Interface SigningHandler
- All Known Implementing Classes:
ECDSASigningHandler,EdDSASigningHandler,HmacSigningHandler,NOPSigningHandler,RSASigningHandler,SecretECDSASigningHandler,SecretEdDSASigningHandler,SecretHmacSigningHandler,SecretRSASigningHandler,SecretSigningHandler
public interface SigningHandler
The interface for SigningHandlers for all the different signing algorithms.
Provides methods for signing data and verifying the signatures of data.
Important: a signing handler cannot be shared and/or re-used, it's a one-time object.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]sign(JwsAlgorithm algorithm, byte[] data) Signs the given raw data bytes using the Java Cryptographic algorithm defined by the JwsAlgorithm.default byte[]sign(JwsAlgorithm algorithm, String data) Signs the given String data using the Java Cryptographic algorithm defined by the JwsAlgorithm.booleanverify(JwsAlgorithm algorithm, byte[] data, byte[] signature) Verifies that the given signature is valid for the given data.
-
Method Details
-
sign
Signs the given String data using the Java Cryptographic algorithm defined by the JwsAlgorithm. The signature is created using the given private key.- Parameters:
algorithm- The JwsAlgorithm defining the Java Cryptographic algorithm.data- The data to be signed.- Returns:
- A byte array of the signature.
-
sign
Signs the given raw data bytes using the Java Cryptographic algorithm defined by the JwsAlgorithm.- Parameters:
algorithm- the JWS signature algorithm to use.data- the raw data to sign.- Returns:
- the signature.
-
verify
Verifies that the given signature is valid for the given data.Uses the Java Cryptographic algorithm defined by the JwsAlgorithm and private key to create a new signature of the data to compare against the given signature to see if they are identical.
- Parameters:
algorithm- The JwsAlgorithm defining the JavaCryptographic algorithm.data- The data that was signed.signature- The signature of the data.- Returns:
trueif the signature is a valid signature of the data.
-