Digital Authentication Framework  6.0.1.37
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
com.good.daf.class2.Class2Key Class Reference

Key implementation for the com.good.daf.class2.Class2Device. More...

Inheritance diagram for com.good.daf.class2.Class2Key:
com.good.daf.basic.BasicKey com.good.daf.DAKey

Public Member Functions

DAMetaData getInfo ()
 Get information about this instance. More...
 
DAMechanism[] getMechanisms ()
 Get the list of supported mechanisms. More...
 
void sign (DAMessage msg) throws DAError
 Sign the message returned by msg.getPlaintext(), and place the signature in msg. More...
 
void verify (DAMessage msg) throws DAError
 Verify the message returned by msg.getPlaintext() against the signature returned by msg.getCiphertext(). More...
 
- Public Member Functions inherited from com.good.daf.basic.BasicKey
DAMechanism[] getMechanisms ()
 Get the list of supported mechanisms. More...
 
void encrypt (DAMessage msg) throws DAError
 Encrypt the message returned by msg.getPlaintext(), and place the result in msg. More...
 
void decrypt (DAMessage msg) throws DAError
 Decrypt the ciphertext returned by msg.getCiphertext(), and place the plaintext in msg using msg.setPlaintext(). More...
 
void sign (DAMessage msg) throws DAError
 Sign the message returned by msg.getPlaintext(), and place the signature in msg. More...
 
void verify (DAMessage msg) throws DAError
 Verify the message returned by msg.getPlaintext() against the signature returned by msg.getCiphertext(). More...
 
byte[] getData () throws DAError
 Returns the contents of a storage-only key. More...
 
void setData (byte[] data) throws DAError
 Sets the contents of a storage-only key. More...
 
void generateMaterial () throws DAError
 Regenerate underlying key material. More...
 

Static Public Member Functions

static Class2Key build ()
 

Static Public Attributes

static DAMechanism mech = DAMechanism.Preset.hmacWithSHA256
 

Detailed Description

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.

Member Function Documentation

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.)

Returns
the metadata object for this instance. Must not be null.

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.).

Returns
a list of DAMechanism instances, one per supported mechanism. This list can be empty, but should not be null nor contain null elements.

Implements com.good.daf.DAKey.

void com.good.daf.class2.Class2Key.sign ( DAMessage  msg) throws DAError

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().

Parameters
msgthe object containing the message plaintext (on entry) and signature (on exit)
Exceptions
DAErroron failure

Implements com.good.daf.DAKey.

void com.good.daf.class2.Class2Key.verify ( DAMessage  msg) throws DAError

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.

Parameters
msgthe object containing the message plaintext and signature
Exceptions
DAErroron failure

Implements com.good.daf.DAKey.


The documentation for this class was generated from the following file: