public interface Signature extends AlgorithmNameProvider
javax.crypto.Signature object. The reported algorithm name refers to
the signature type being applied.| Modifier and Type | Method and Description |
|---|---|
void |
initSigner(java.security.PrivateKey key) |
void |
initVerifier(java.security.PublicKey key) |
byte[] |
sign()
Compute the signature
|
default void |
update(byte[] hash)
Update the computed signature with the given data
|
void |
update(byte[] hash,
int off,
int len)
Update the computed signature with the given data
|
boolean |
verify(byte[] sig)
Verify against the given signature
|
getAlgorithmvoid initVerifier(java.security.PublicKey key)
throws java.lang.Exception
key - The PublicKey to be used for verifying signaturesjava.lang.Exception - If failed to initializevoid initSigner(java.security.PrivateKey key)
throws java.lang.Exception
key - The PrivateKey to be used for signingjava.lang.Exception - If failed to initializedefault void update(byte[] hash)
throws java.lang.Exception
hash - The hash data bufferjava.lang.Exception - If failed to updateupdate(byte[], int, int)void update(byte[] hash,
int off,
int len)
throws java.lang.Exception
hash - The hash data bufferoff - Offset of hash data in bufferlen - Length of hash datajava.lang.Exception - If failed to updateboolean verify(byte[] sig)
throws java.lang.Exception
sig - The signed datatrue if signature is validjava.lang.Exception - If failed to extract signed data for validationbyte[] sign()
throws java.lang.Exception
java.lang.Exception - If failed to calculate the signature