Digital Authentication Framework
6.0.1.37
|
This type contains the inputs and outputs of a cryptographic transform. More...
Public Member Functions | |
DAMessage () | |
Basic constructor. More... | |
DAMechanism | getMechanism () |
DADigestType | getDigestType () |
byte[] | getIV () |
byte[] | getPlaintext () |
byte[] | getCiphertext () |
void | setMechanism (DAMechanism newMech) |
Sets the mechanism. More... | |
void | setDigestType (DADigestType newDigest) |
Sets the digest type. More... | |
void | setIV (byte[] newIV) |
Sets the IV. More... | |
void | setPlaintext (byte[] newPt) |
Sets the plaintext. More... | |
void | setCiphertext (byte[] newCt) |
Sets the ciphertext. More... | |
boolean | setMechanismForRSAPkcs1Signature () |
Set mechanism appropriately for RSA PKCS#1 signatures. More... | |
boolean | setMechanismForDSA () |
Set mechanism appropriately for DSA algorithm. More... | |
boolean | setMechanismForECDSA () |
Set mechanism appropriately for ECDSA algorithm. More... | |
boolean | applyDefaultDigest () |
Ensure the DAMessage contains a pre-hashed message. More... | |
byte[] | getPkcs1SignatureData () |
Create a byte string suitable for RSA PKCS#1 signature. More... | |
String | toString () |
Stringifies the message contents. More... | |
Static Public Member Functions | |
static DAMessage | build (byte[] plain, byte[] cipher, byte[] iv, byte[] mechoid, int digest) |
This is a one-shot constructor from a set of byte strings. More... | |
This type contains the inputs and outputs of a cryptographic transform.
An instance of this type can contain a mechanism, digest type, iv, plaintext and ciphertext. All items are optional. A new instance of this class starts with none present and a digest type of 'none'.
com.good.daf.DAMessage.DAMessage | ( | ) |
Basic constructor.
The instance starts without any mechanism, iv, plaintext or ciphertext.
boolean com.good.daf.DAMessage.applyDefaultDigest | ( | ) |
Ensure the DAMessage contains a pre-hashed message.
If the digest type is already set, does nothing and returns false. Otherwise, applies a default hash algorithm (SHA-256 in the current release) to the plaintext field, and sets the digest type accordingly. Returns true if the DAMessage was changed.
|
static |
This is a one-shot constructor from a set of byte strings.
This constructor is mainly for the benefit of JNI calling code.
plain | plaintext, may be null |
cipher | ciphertext, may be null |
iv | iv, may be null |
mechoid | mechanism encoded OID, may be null |
digest | digest type ordinal (in DADigestType enumeration) |
byte [] com.good.daf.DAMessage.getCiphertext | ( | ) |
DADigestType com.good.daf.DAMessage.getDigestType | ( | ) |
byte [] com.good.daf.DAMessage.getIV | ( | ) |
DAMechanism com.good.daf.DAMessage.getMechanism | ( | ) |
byte [] com.good.daf.DAMessage.getPkcs1SignatureData | ( | ) |
Create a byte string suitable for RSA PKCS#1 signature.
byte [] com.good.daf.DAMessage.getPlaintext | ( | ) |
void com.good.daf.DAMessage.setCiphertext | ( | byte[] | newCt | ) |
Sets the ciphertext.
newCt | new ciphertext value, may be null to unset ciphertext |
void com.good.daf.DAMessage.setDigestType | ( | DADigestType | newDigest | ) |
Sets the digest type.
newDigest | new digest type, may be null to reset to default (none) |
void com.good.daf.DAMessage.setIV | ( | byte[] | newIV | ) |
Sets the IV.
newIV | new IV value, may be null to unset IV |
void com.good.daf.DAMessage.setMechanism | ( | DAMechanism | newMech | ) |
Sets the mechanism.
newMech | new mechanism value, may be null to unset mechanism |
boolean com.good.daf.DAMessage.setMechanismForDSA | ( | ) |
Set mechanism appropriately for DSA algorithm.
Chooses a suitable DAMechanism (see DAMechanism.Preset) for the hash algorithm identified by the digest type field, and sets it as the mechanism field.
boolean com.good.daf.DAMessage.setMechanismForECDSA | ( | ) |
Set mechanism appropriately for ECDSA algorithm.
Chooses a suitable DAMechanism (see DAMechanism.Preset) for the hash algorithm identified by the digest type field, and sets it as the mechanism field.
boolean com.good.daf.DAMessage.setMechanismForRSAPkcs1Signature | ( | ) |
Set mechanism appropriately for RSA PKCS#1 signatures.
Choose a suitable DAMechanism (see DAMechanism.Preset) for the hash algorithm identified by the digest type field, and sets it as the mechanism field.
void com.good.daf.DAMessage.setPlaintext | ( | byte[] | newPt | ) |
Sets the plaintext.
newPt | new plaintext value, may be null to unset plaintext |
String com.good.daf.DAMessage.toString | ( | ) |
Stringifies the message contents.
Note that this can contain sensitive plaintext content.