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(SessionContext session,
java.security.PrivateKey key) |
void |
initVerifier(SessionContext session,
java.security.PublicKey key) |
byte[] |
sign(SessionContext session)
Compute the signature
|
default void |
update(SessionContext session,
byte[] hash)
Update the computed signature with the given data
|
void |
update(SessionContext session,
byte[] hash,
int off,
int len)
Update the computed signature with the given data
|
boolean |
verify(SessionContext session,
byte[] sig)
Verify against the given signature
|
getAlgorithm
void initVerifier(SessionContext session, java.security.PublicKey key) throws java.lang.Exception
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextkey
- The PublicKey
to be used for verifying signaturesjava.lang.Exception
- If failed to initializevoid initSigner(SessionContext session, java.security.PrivateKey key) throws java.lang.Exception
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextkey
- The PrivateKey
to be used for signingjava.lang.Exception
- If failed to initializedefault void update(SessionContext session, byte[] hash) throws java.lang.Exception
session
- The SessionContext
for calling this method - may be null
if not called within a
session contexthash
- The hash data bufferjava.lang.Exception
- If failed to updateupdate(SessionContext, byte[], int, int)
void update(SessionContext session, byte[] hash, int off, int len) throws java.lang.Exception
session
- The SessionContext
for calling this method - may be null
if not called within a
session contexthash
- The hash data bufferoff
- Offset of hash data in bufferlen
- Length of hash datajava.lang.Exception
- If failed to updateboolean verify(SessionContext session, byte[] sig) throws java.lang.Exception
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextsig
- The signed datatrue
if signature is validjava.lang.Exception
- If failed to extract signed data for validationbyte[] sign(SessionContext session) throws java.lang.Exception
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextjava.lang.Exception
- If failed to calculate the signature