Digital Authentication Framework 4.2.0.30
|
Key implementation for the com.good.daf.class2.Class2Device. More...
Public Member Functions | |
DAMetaData | getInfo () |
Get information about this instance. | |
DAMechanism[] | getMechanisms () |
Get the list of supported mechanisms. | |
void | sign (DAMessage msg) throws DAError |
Sign the message returned by msg.getPlaintext(), and place the signature in msg. | |
void | verify (DAMessage msg) throws DAError |
Verify the message returned by msg.getPlaintext() against the signature returned by msg.getCiphertext(). | |
Static Public Member Functions | |
static Class2Key | build () |
Static Public Attributes | |
static DAMechanism | mech = DAMechanism.Preset.hmacWithSHA256 |
Package Functions | |
byte[] | HMACSHA256 (byte[] key, byte[] data) |
Package Attributes | |
BasicMetaData | meta = new BasicMetaData() |
Static Package Attributes | |
static byte[] | key = new byte[] { 1, 2, 3, 4 } |
Key implementation for the com.good.daf.class2.Class2Device.
This implementation does HMAC-SHA256 signing and verification.
The key material used by all instances of this key is fixed as the four byte string: 1, 2, 3, 4. This makes it somewhat useless, except for example purposes.
DAMetaData com.good.daf.class2.Class2Key.getInfo | ( | ) |
Get information about this instance.
This method will be called once shortly after construction and the result wrapped by the native translation layer.
This method is not allowed to fail except fatally (OutOfMemoryError, etc.)
Implements com.good.daf.DAKey.
DAMechanism [] com.good.daf.class2.Class2Key.getMechanisms | ( | ) |
Get the list of supported mechanisms.
This method is not allowed to fail except fatally (OutOfMemoryError, etc.).
Reimplemented from com.good.daf.basic.BasicKey.
Sign the message returned by msg.getPlaintext(), and place the signature in msg.
If msg.getMechanism() returns non-null, you should try to use that mechanism. If it is not supported, throw DAError.MechNotSupported.
If msg.getMechanism() returns null, choose an appropriate mechanism and call msg.setMechanism() to note your choice.
Place the signature in msg using msg.setCiphertext(), and any IV or nonce likewise using msg.setIV().
msg | the object containing the message plaintext (on entry) and signature (on exit) |
DAError | on failure |
Reimplemented from com.good.daf.basic.BasicKey.
Verify the message returned by msg.getPlaintext() against the signature returned by msg.getCiphertext().
msg.getMechanism() will always return non-null here, specifying what signature verification mechanism to use.
If the signature is invalid, throw DAError.VerifyFailed.
msg | the object containing the message plaintext and signature |
DAError | on failure |
Reimplemented from com.good.daf.basic.BasicKey.