Include (somehow missed) support for send/receive encrypted MMS.

This commit is contained in:
Moxie Marlinspike 2013-05-16 13:48:44 -07:00
parent e5f634ba45
commit c86e414c5f
4 changed files with 9 additions and 6 deletions

View File

@ -795,11 +795,11 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
if (attachmentManager.isAttachmentPresent()) { if (attachmentManager.isAttachmentPresent()) {
allocatedThreadId = MessageSender.sendMms(ConversationActivity.this, masterSecret, recipients, allocatedThreadId = MessageSender.sendMms(ConversationActivity.this, masterSecret, recipients,
threadId, attachmentManager.getSlideDeck(), body, threadId, attachmentManager.getSlideDeck(), body,
distributionType, forcePlaintext); distributionType, isEncryptedConversation && !forcePlaintext);
} else if (recipients.isEmailRecipient() || !recipients.isSingleRecipient()) { } else if (recipients.isEmailRecipient() || !recipients.isSingleRecipient()) {
allocatedThreadId = MessageSender.sendMms(ConversationActivity.this, masterSecret, recipients, allocatedThreadId = MessageSender.sendMms(ConversationActivity.this, masterSecret, recipients,
threadId, new SlideDeck(), body, distributionType, threadId, new SlideDeck(), body, distributionType,
forcePlaintext); isEncryptedConversation && !forcePlaintext);
} else { } else {
OutgoingTextMessage message; OutgoingTextMessage message;

View File

@ -46,6 +46,7 @@ import ws.com.google.android.mms.MmsException;
import ws.com.google.android.mms.pdu.MultimediaMessagePdu; import ws.com.google.android.mms.pdu.MultimediaMessagePdu;
import ws.com.google.android.mms.pdu.PduParser; import ws.com.google.android.mms.pdu.PduParser;
import ws.com.google.android.mms.pdu.RetrieveConf; import ws.com.google.android.mms.pdu.RetrieveConf;
import ws.com.google.android.mms.pdu.SendReq;
/** /**
* A work queue for processing a number of encryption operations. * A work queue for processing a number of encryption operations.
@ -192,7 +193,9 @@ public class DecryptingQueue {
plaintextPduBytes = cipher.decryptMessage(ciphertextPduBytes); plaintextPduBytes = cipher.decryptMessage(ciphertextPduBytes);
} }
RetrieveConf plaintextPdu = (RetrieveConf)new PduParser(plaintextPduBytes).parse(); MultimediaMessagePdu plaintextGenericPdu = (MultimediaMessagePdu)new PduParser(plaintextPduBytes).parse();
RetrieveConf plaintextPdu = new RetrieveConf(plaintextGenericPdu.getPduHeaders(),
plaintextGenericPdu.getBody());
Log.w("DecryptingQueue", "Successfully decrypted MMS!"); Log.w("DecryptingQueue", "Successfully decrypted MMS!");
database.insertSecureDecryptedMessageInbox(masterSecret, plaintextPdu, threadId); database.insertSecureDecryptedMessageInbox(masterSecret, plaintextPdu, threadId);
database.delete(messageId); database.delete(messageId);

View File

@ -40,7 +40,7 @@ public class MessageSender {
public static long sendMms(Context context, MasterSecret masterSecret, Recipients recipients, public static long sendMms(Context context, MasterSecret masterSecret, Recipients recipients,
long threadId, SlideDeck slideDeck, String message, int distributionType, long threadId, SlideDeck slideDeck, String message, int distributionType,
boolean forcePlaintext) boolean secure)
throws MmsException throws MmsException
{ {
if (threadId == -1) if (threadId == -1)
@ -68,7 +68,7 @@ public class MessageSender {
// sendMms(context, insecureRecipients, masterSecret, sendRequest, threadId, false); // sendMms(context, insecureRecipients, masterSecret, sendRequest, threadId, false);
// } // }
sendMms(context, recipients, masterSecret, sendRequest, threadId, distributionType, false); sendMms(context, recipients, masterSecret, sendRequest, threadId, distributionType, secure);
return threadId; return threadId;
} }

View File

@ -51,7 +51,7 @@ public class RetrieveConf extends MultimediaMessagePdu {
* @param headers Headers for this PDU. * @param headers Headers for this PDU.
* @param body Body of this PDu. * @param body Body of this PDu.
*/ */
RetrieveConf(PduHeaders headers, PduBody body) { public RetrieveConf(PduHeaders headers, PduBody body) {
super(headers, body); super(headers, body);
} }