public class Signer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALG_SHA256_WITH_ECDSA |
Constructor and Description |
---|
Signer(java.lang.String algorithm)
Constructor using the specified algoritm (one of ALG_ constants)
when generating signatures.
|
Signer(java.lang.String algorithm,
java.lang.String provider)
Constructor using the specified algoritm (one of ALG_ constants)
and provider when generating signatures.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
sign(java.security.PrivateKey privKey,
byte[] data)
Method to generate a cryptographic signature of the data using the specificed algorithm
and the given curve of the given private key.
|
boolean |
verify(java.security.PublicKey pubKey,
byte[] data,
byte[] signature)
Help method to verify a signature.
|
public static final java.lang.String ALG_SHA256_WITH_ECDSA
public Signer(java.lang.String algorithm)
algorithm
- the algorithm to use.public Signer(java.lang.String algorithm, java.lang.String provider)
algorithm
- the algorithm to use.provider
- the provider to use.public byte[] sign(java.security.PrivateKey privKey, byte[] data) throws InternalErrorException
privKey
- the private key to use for the signature.data
- the data to hash and sign.InternalErrorException
- if internal problems occurred generating the signature.public boolean verify(java.security.PublicKey pubKey, byte[] data, byte[] signature) throws InternalErrorException
pubKey
- the public key to verify.data
- the data to verifysignature
- the signature to verifyInternalErrorException
- in problems occurred verifying the signature.