Class HmacSHA256
java.lang.Object
de.christofreichardt.json.websignature.HmacSHA256
- All Implemented Interfaces:
de.christofreichardt.diagnosis.Traceable,JWSAlgorithm
An apapter to the underlying MAC instance provided by the Java platform which has the same name.
- Author:
- Christof Reichardt
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the underlying algorithm object.de.christofreichardt.diagnosis.AbstractTracervoidInitialises the underlying algorithm provided by the Java platform with the given key.byte[]Requests a signature from the underlying algorithm for the delivered bytes.voidupdate(byte[] data) Hands over the given bytes to the underlying algorithm provided by the Java platform.booleanverify(byte[] signature) Requests the validation of the delivered data agianst the given signature.
-
Method Details
-
init
Description copied from interface:JWSAlgorithmInitialises the underlying algorithm provided by the Java platform with the given key.- Specified by:
initin interfaceJWSAlgorithm- Parameters:
key- the cryptographic key used for signing or validating.- Throws:
InvalidKeyException
-
update
public void update(byte[] data) Description copied from interface:JWSAlgorithmHands over the given bytes to the underlying algorithm provided by the Java platform.- Specified by:
updatein interfaceJWSAlgorithm- Parameters:
data- the data to be signed or to be validated.
-
signature
public byte[] signature()Description copied from interface:JWSAlgorithmRequests a signature from the underlying algorithm for the delivered bytes.- Specified by:
signaturein interfaceJWSAlgorithm- Returns:
- the signature bytes
-
verify
public boolean verify(byte[] signature) Description copied from interface:JWSAlgorithmRequests the validation of the delivered data agianst the given signature.- Specified by:
verifyin interfaceJWSAlgorithm- Parameters:
signature- the signature bytes.- Returns:
- indicates if the signature has been valid.
-
algorithm
Description copied from interface:JWSAlgorithmReturns the name of the underlying algorithm object.- Specified by:
algorithmin interfaceJWSAlgorithm- Returns:
- the name of the underlying algorithm object.
-
getCurrentTracer
public de.christofreichardt.diagnosis.AbstractTracer getCurrentTracer()- Specified by:
getCurrentTracerin interfacede.christofreichardt.diagnosis.Traceable
-