mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-27 12:19:04 +00:00
Refactor the ciphertext message parsing and building.
This commit is contained in:
@@ -40,6 +40,7 @@ import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||
import org.whispersystems.textsecure.crypto.protocol.CiphertextMessage;
|
||||
import org.whispersystems.textsecure.crypto.protocol.PreKeyBundleMessage;
|
||||
import org.whispersystems.textsecure.storage.InvalidKeyIdException;
|
||||
|
||||
@@ -182,9 +183,9 @@ public class ReceiveKeyActivity extends Activity {
|
||||
} else if (keyExchangeMessageBundle != null) {
|
||||
try {
|
||||
keyExchangeProcessor.processKeyExchangeMessage(keyExchangeMessageBundle);
|
||||
byte[] bundledMessage = keyExchangeMessageBundle.getBundledMessage();
|
||||
CiphertextMessage bundledMessage = keyExchangeMessageBundle.getBundledMessage();
|
||||
SmsTransportDetails transportDetails = new SmsTransportDetails();
|
||||
String messageBody = new String(transportDetails.getEncodedMessage(bundledMessage));
|
||||
String messageBody = new String(transportDetails.getEncodedMessage(bundledMessage.serialize()));
|
||||
|
||||
DatabaseFactory.getEncryptingSmsDatabase(ReceiveKeyActivity.this)
|
||||
.updateBundleMessageBody(masterSecret, messageId, messageBody);
|
||||
@@ -196,6 +197,10 @@ public class ReceiveKeyActivity extends Activity {
|
||||
Log.w("ReceiveKeyActivity", e);
|
||||
DatabaseFactory.getEncryptingSmsDatabase(ReceiveKeyActivity.this)
|
||||
.markAsCorruptKeyExchange(messageId);
|
||||
} catch (InvalidKeyException e) {
|
||||
Log.w("ReceiveKeyActivity", e);
|
||||
DatabaseFactory.getEncryptingSmsDatabase(ReceiveKeyActivity.this)
|
||||
.markAsCorruptKeyExchange(messageId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user