Digital Authentication Framework 4.2.0.30
Public Member Functions

com.good.daf.basic.BasicKey Class Reference

This implements DAKey in a basic sense, but returns errors for all crypto/storage calls. More...

Inheritance diagram for com.good.daf.basic.BasicKey:
com.good.daf.DAKey com.good.daf.class0.Class0Key com.good.daf.class1.Class1Key com.good.daf.class2.Class2Key com.good.daf.class3.Class3Key

List of all members.

Public Member Functions

DAMechanism[] getMechanisms ()
 Get the list of supported mechanisms.
void encrypt (DAMessage msg) throws DAError
 Encrypt the message returned by msg.getPlaintext(), and place the result in msg.
void decrypt (DAMessage msg) throws DAError
 Decrypt the ciphertext returned by msg.getCiphertext(), and place the plaintext in msg using msg.setPlaintext().
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().
byte[] getData () throws DAError
 Returns the contents of a storage-only key.
void setData (byte[] data) throws DAError
 Sets the contents of a storage-only key.
void generateMaterial () throws DAError
 Regenerate underlying key material.

Detailed Description

This implements DAKey in a basic sense, but returns errors for all crypto/storage calls.

This is a good base to build a real DAKey implementation, because you only need implement the methods you are interested in.

It does not provide the getInfo call, so is abstract.


Member Function Documentation

void com.good.daf.basic.BasicKey.decrypt ( DAMessage  msg) throws DAError

Decrypt the ciphertext returned by msg.getCiphertext(), and place the plaintext in msg using msg.setPlaintext().

msg.getMechanism() will always return non-null here, specifying what decryption mechanism to use.

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

Implements com.good.daf.DAKey.

Reimplemented in com.good.daf.class3.Class3Key.

void com.good.daf.basic.BasicKey.encrypt ( DAMessage  msg) throws DAError

Encrypt the message returned by msg.getPlaintext(), and place the result 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 ciphertext in msg using msg.setCiphertext(), and any IV likewise using msg.setIV().

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

Implements com.good.daf.DAKey.

Reimplemented in com.good.daf.class3.Class3Key.

void com.good.daf.basic.BasicKey.generateMaterial ( ) throws DAError

Regenerate underlying key material.

DAF calls this to roll over the key material. The type and capabilities of the key should remain the same. Class 1 implementations may throw DAError.NotImplemented in which case DAF will use setData() instead.

Exceptions:
DAErroron failure

Implements com.good.daf.DAKey.

byte [] com.good.daf.basic.BasicKey.getData ( ) throws DAError

Returns the contents of a storage-only key.

Returns:
the contents of the storage (must not be null).
Exceptions:
DAErroron failure

Implements com.good.daf.DAKey.

Reimplemented in com.good.daf.class0.Class0Key, and com.good.daf.class1.Class1Key.

DAMechanism [] com.good.daf.basic.BasicKey.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.

Reimplemented in com.good.daf.class2.Class2Key, and com.good.daf.class3.Class3Key.

void com.good.daf.basic.BasicKey.setData ( byte[]  data) throws DAError

Sets the contents of a storage-only key.

Parameters:
datathe new data to write to the storage. Never null.
Exceptions:
DAErroron failure

Implements com.good.daf.DAKey.

Reimplemented in com.good.daf.class1.Class1Key.

void com.good.daf.basic.BasicKey.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.

Reimplemented in com.good.daf.class2.Class2Key, and com.good.daf.class3.Class3Key.

void com.good.daf.basic.BasicKey.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.

Reimplemented in com.good.daf.class2.Class2Key.


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