Search in sources :

Example 1 with AsymmetricMasterCipher

use of org.thoughtcrime.securesms.crypto.AsymmetricMasterCipher in project Signal-Android by WhisperSystems.

the class MasterSecretDecryptJob method getAsymmetricDecryptedBody.

private String getAsymmetricDecryptedBody(MasterSecret masterSecret, String body) throws InvalidMessageException {
    try {
        AsymmetricMasterSecret asymmetricMasterSecret = MasterSecretUtil.getAsymmetricMasterSecret(context, masterSecret);
        AsymmetricMasterCipher asymmetricMasterCipher = new AsymmetricMasterCipher(asymmetricMasterSecret);
        if (TextUtils.isEmpty(body))
            return "";
        else
            return asymmetricMasterCipher.decryptBody(body);
    } catch (IOException e) {
        throw new InvalidMessageException(e);
    }
}
Also used : InvalidMessageException(org.whispersystems.libsignal.InvalidMessageException) AsymmetricMasterSecret(org.thoughtcrime.securesms.crypto.AsymmetricMasterSecret) IOException(java.io.IOException) AsymmetricMasterCipher(org.thoughtcrime.securesms.crypto.AsymmetricMasterCipher)

Aggregations

IOException (java.io.IOException)1 AsymmetricMasterCipher (org.thoughtcrime.securesms.crypto.AsymmetricMasterCipher)1 AsymmetricMasterSecret (org.thoughtcrime.securesms.crypto.AsymmetricMasterSecret)1 InvalidMessageException (org.whispersystems.libsignal.InvalidMessageException)1