mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-20 11:52:07 +00:00
Resolved a few MMS issues.
1) Fixed the "Unsupported Encoding!" problem. 2) Workaround for the Sprint issue, where the MMSC is adding a single extra byte to the end of each encrypted message. 3) Fixed the "large blob of base64 text" on encrypted MMS problem.
This commit is contained in:
@@ -190,7 +190,21 @@ public class DecryptingQueue {
|
||||
synchronized (SessionCipher.CIPHER_LOCK) {
|
||||
Log.w("DecryptingQueue", "Decrypting: " + Hex.toString(ciphertextPduBytes));
|
||||
SessionCipher cipher = new SessionCipher(context, masterSecret, recipient, new TextTransport());
|
||||
plaintextPduBytes = cipher.decryptMessage(ciphertextPduBytes);
|
||||
try {
|
||||
plaintextPduBytes = cipher.decryptMessage(ciphertextPduBytes);
|
||||
} catch (InvalidMessageException ime) {
|
||||
// XXX - For some reason, Sprint seems to append a single character to the
|
||||
// end of message text segments. I don't know why, so here we just try
|
||||
// truncating the message by one if the MAC fails.
|
||||
if (ciphertextPduBytes.length > 2) {
|
||||
Log.w("DecryptingQueue", "Attempting truncated decrypt...");
|
||||
byte[] truncated = new byte[ciphertextPduBytes.length - 1];
|
||||
System.arraycopy(ciphertextPduBytes, 0, truncated, 0, truncated.length);
|
||||
plaintextPduBytes = cipher.decryptMessage(truncated);
|
||||
} else {
|
||||
throw ime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MultimediaMessagePdu plaintextGenericPdu = (MultimediaMessagePdu)new PduParser(plaintextPduBytes).parse();
|
||||
|
@@ -90,7 +90,8 @@ public class KeyExchangeMessage {
|
||||
this.serialized = messageBody;
|
||||
|
||||
if (messageVersion > Message.SUPPORTED_VERSION)
|
||||
throw new InvalidVersionException("Key exchange with version: " + messageVersion + " but we only support: " + Message.SUPPORTED_VERSION);
|
||||
throw new InvalidVersionException("Key exchange with version: " + messageVersion +
|
||||
" but we only support: " + Message.SUPPORTED_VERSION);
|
||||
|
||||
if (messageVersion >= 1)
|
||||
keyBytes = Base64.decodeWithoutPadding(messageBody);
|
||||
|
Reference in New Issue
Block a user