T_IdKeyPair - IdentityKeyPair classT_IdKey - IdentityKey classT_PreKey - PreKey classT_SigPreKey - SignedPreKey classT_Sess - Session classT_Addr - Address classT_ECPub - Elliptic Curve PublicKey classT_Bundle - Bundle classT_Ciph - Cipher classpublic class OmemoMessageBuilder<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
extends java.lang.Object
| Constructor and Description |
|---|
OmemoMessageBuilder(OmemoDevice userDevice,
OmemoTrustCallback callback,
OmemoRatchet<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> ratchet,
byte[] aesKey,
byte[] iv,
java.lang.String message)
Create an OmemoMessageBuilder.
|
OmemoMessageBuilder(OmemoDevice userDevice,
OmemoTrustCallback callback,
OmemoRatchet<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> ratchet,
java.lang.String message)
Create an OmemoMessageBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRecipient(OmemoDevice contactsDevice)
Add a new recipient device to the message.
|
OmemoElement |
finish()
Assemble an OmemoMessageElement from the current state of the builder.
|
static byte[] |
generateIv()
Generate a 16 byte initialization vector for AES encryption.
|
static byte[] |
generateKey(java.lang.String keyType,
int keyLength)
Generate a new AES key used to encrypt the message.
|
public OmemoMessageBuilder(OmemoDevice userDevice, OmemoTrustCallback callback, OmemoRatchet<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> ratchet, byte[] aesKey, byte[] iv, java.lang.String message) throws javax.crypto.NoSuchPaddingException, javax.crypto.BadPaddingException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.IllegalBlockSizeException, java.security.InvalidAlgorithmParameterException
userDevice - our OmemoDevicecallback - trustCallback for querying trust decisionsratchet - our OmemoRatchetaesKey - aes message key used for message encryptioniv - initialization vector used for message encryptionmessage - message we want to sendjavax.crypto.NoSuchPaddingExceptionjavax.crypto.BadPaddingExceptionjava.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.IllegalBlockSizeExceptionjava.security.InvalidAlgorithmParameterExceptionpublic OmemoMessageBuilder(OmemoDevice userDevice, OmemoTrustCallback callback, OmemoRatchet<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> ratchet, java.lang.String message) throws javax.crypto.NoSuchPaddingException, javax.crypto.BadPaddingException, java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.IllegalBlockSizeException, java.io.UnsupportedEncodingException, java.security.InvalidAlgorithmParameterException
userDevice - our OmemoDevicecallback - trustCallback for querying trust decisionsratchet - our OmemoRatchetmessage - message we want to sendjavax.crypto.NoSuchPaddingExceptionjavax.crypto.BadPaddingExceptionjava.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.IllegalBlockSizeExceptionjava.io.UnsupportedEncodingExceptionjava.security.InvalidAlgorithmParameterExceptionpublic void addRecipient(OmemoDevice contactsDevice) throws NoIdentityKeyException, CorruptedOmemoKeyException, UndecidedOmemoIdentityException, UntrustedOmemoIdentityException
contactsDevice - device of the recipientNoIdentityKeyException - if we have no identityKey of that device. Can be fixed by fetching and
processing the devices bundle.CorruptedOmemoKeyException - if the identityKey of that device is corrupted.UndecidedOmemoIdentityException - if the user hasn't yet decided whether to trust that device or not.UntrustedOmemoIdentityException - if the user has decided not to trust that device.public OmemoElement finish()
public static byte[] generateKey(java.lang.String keyType,
int keyLength)
throws java.security.NoSuchAlgorithmException
keyType - Key TypekeyLength - Key Length in bitjava.security.NoSuchAlgorithmExceptionpublic static byte[] generateIv()