Digital Authentication Framework 4.2.0.30
|
Key implementation for the com.good.daf.class3.Class3Device. More...
Public Member Functions | |
DAMetaData | getInfo () |
Get information about this instance. | |
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. | |
Static Public Member Functions | |
static Class3Key | build () |
Static Public Attributes | |
static DAMechanism | encrypt_mech = DAMechanism.Preset.rsaEncryption |
static DAMechanism | sign_mech = DAMechanism.Preset.sha256WithRSAEncryption |
Package Functions | |
byte[] | encrypt (PublicKey key, byte[] plaintext) |
byte[] | decrypt (PrivateKey key, byte[] ciphertext) |
byte[] | sign (PrivateKey key, byte[] rawPkcs1MR) |
Static Package Attributes | |
static PrivateKey | privKey |
static PublicKey | pubKey |
Key implementation for the com.good.daf.class3.Class3Device.
The key material used by all instances of this key is backed by the same global location: a fresh key is generated during static initialisation. This makes it somewhat useless, except for example purposes.
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.
msg | the object containing the message ciphertext (on entry) and plaintext (on exit) |
DAError | on failure |
Reimplemented from com.good.daf.basic.BasicKey.
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().
msg | the object containing the message plaintext (on entry) and ciphertext (on exit) |
DAError | on failure |
Reimplemented from com.good.daf.basic.BasicKey.
DAMetaData com.good.daf.class3.Class3Key.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.class3.Class3Key.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.