public class SignatureHelper extends Object
Signature class to accomplish the signing operations. The helper works with a set SignatureHelper.SignatureAlgorithm which
is defined at creation.| Modifier and Type | Class and Description |
|---|---|
static class |
SignatureHelper.SignatureAlgorithm
This enumeration represents the signature algorithms that Absio knowingly supports.
|
| Constructor and Description |
|---|
SignatureHelper()
Create a helper with
SignatureHelper.SignatureAlgorithm.DEFAULT for signing and signature verification. |
SignatureHelper(SignatureHelper.SignatureAlgorithm algorithm)
Create a helper with the given
SignatureHelper.SignatureAlgorithm for signing and signature verification. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
sign(PrivateKey key,
byte[] data)
Sign the data with the given private key.
|
boolean |
verify(PublicKey key,
byte[] data,
byte[] signature) |
public SignatureHelper(SignatureHelper.SignatureAlgorithm algorithm) throws NoSuchAlgorithmException
SignatureHelper.SignatureAlgorithm for signing and signature verification.algorithm - the algorithm to use for signing and signature verificationNoSuchAlgorithmException - thrown if the given SignatureHelper.SignatureAlgorithm is not supportedpublic SignatureHelper()
throws NoSuchAlgorithmException
SignatureHelper.SignatureAlgorithm.DEFAULT for signing and signature verification.NoSuchAlgorithmException - thrown if SignatureHelper.SignatureAlgorithm.DEFAULT is not supportedpublic byte[] sign(PrivateKey key, byte[] data) throws InvalidKeyException, SignatureException
key - the key to sign withdata - the data to signInvalidKeyException - thrown if the key is not correct for the helper's SignatureHelper.SignatureAlgorithmSignatureException - thrown is there was an issue signing the datapublic boolean verify(PublicKey key, byte[] data, byte[] signature) throws SignatureException, InvalidKeyException
key - the public portion of the private key used to sign the datadata - the data that was signedsignature - the signatureSignatureException - thrown if the signature is not correctInvalidKeyException - thrown if the key is not correct for the helper's SignatureHelper.SignatureAlgorithmCopyright © 2021. All rights reserved.