Key Exchange Messages not being received and processed on one end.
Device A is running Android 4.3. (Cyanogenmod current.)
SMS is being sent/received via google voice through @koush's Voice+.
Device B is running Android 4.0.4/Sense 3.6. (Can't be upgraded.)
Device B can send a key exchange message to Device A. It is received and processed.
Device A then sends an encrypted message to Device B, but that is received as ciphertext, and not decrypted.
I then cancel the secure session and send a key exchange message from Device A to Device B. The message is received as ciphertext and not decrypted and processed.
So it appears that Device B running Android 4.0.4 cannot process any ciphertext, but can send a session initiation request, and then fails to handle the response.
That or Device A either isn't responding properly with the response to the session initiation request, and/or isn't sending session initiation requests properly.
Any idea on how I can send some debug logs for this that might help figure this out?
Sounds similar to my issue #336, #159, I am having a problem with a stock 4.0.4 sending the 'key' to a stock 4.1.1. It's the message splitting on rooted devices and custom ROMs, the TextSecure or OS doesn't seem to be dividing messages appropriately, See if a logcat says "Bigger than the maximum SMS message size".
I'm also noticing this problem between two cyanogenmod users using voice+, so it may also be related to that...
Is there an out of band method of sending the keys aside from using sms as a backup?
Hm, I tried between TextSecure + Voice+ to another TextSecure user. That worked fine.
I never tried between two Voice+ users.
Try disabling Voice+ and let me know if it works through the native SMS transport. I may be changing the payload in Voice+. Or google strips whitespaces?
I'm not using Voice+ on any TS installed phones. Did you notice when the issue started? My working TS is the .9 version and the non working is a 1. version. Maybe a coincidence but I lost my key sending ability late August at the update?
Tried between two phones w/o gv enabled.
Got this message on the second phone: "Message encrypted for non-existing session..."
(The first phone was able to purportedly setup an encrypted session though.. it just didn't work.)
Is there a .9 apk to try?
satmandu, Can you logcat to see the error? Yup, I get the green lock on the send button too, just get rejected encrypted sends tho. .9? I wonder if it was the update too.
Here's what I get during the "message encrypted for non-existing session..."
W/org.thoughtcrime.securesms.sms.MultipartSmsTransportMessage(23945): Decoded message with version: 1
W/MultipartSmsMessageHandler(23945): Processing single part message...
E/ExternalAccountType(31033): Unsupported attribute readOnly
D/AccountTypeManager(31033): Registering extension package account type=com.google, dataSet=plus, packageName=com.google.android.apps.plus
I/AccountTypeManager(31033): Loaded meta-data for 8 account types, 7 accounts in 133ms(wall) 36ms(cpu)
W/MmsSmsDatabase(23945): Executing query: SELECT _id, body, type, thread_id, address, subject, date_sent, date_received, m_type, msg_box, status, part_count, ct_l, tr_id, m_size, exp, st, transport_type FROM (SELECT DISTINCT date_sent * 1 AS date_sent, date * 1 AS date_received, _id, body, read, thread_id, type, address, subject, NULL AS m_type, NULL AS msg_box, status, NULL AS part_count, NULL AS ct_l, NULL AS tr_id, NULL AS m_size, NULL AS exp, NULL AS st, 'sms' AS transport_type FROM sms WHERE (thread_id = 72) UNION ALL SELECT DISTINCT date * 1000 AS date_sent, date_received * 1000 AS date_received, _id, body, read, thread_id, NULL AS type, address, NULL AS subject, m_type, msg_box, NULL AS status, part_count, ct_l, tr_id, m_size, exp, st, 'mms' AS transport_type FROM mms WHERE (thread_id = 72) ORDER BY date_received DESC) LIMIT 1
W/DecryptingQueue(23945): Parsing recipient for originator: 917xxxxxxx
W/DecryptingQueue(23945): Parsed Recipient: 917xxxxxxx
W/KeyUtil (23945): Checking session...
W/LocalKeyRecord(23945): Checking: 75-local
W/LocalKeyRecord(23945): Checking: 75-remote
W/DecryptingQueue(23945): No such recipient session...
W/MessageDatabase(23945): Updating ID: 2349 to base type: 134217728
W/MmsSmsDatabase(23945): Executing query: SELECT _id, body, read, type, address, subject, thread_id, status, date_sent, date_received, m_type, msg_box, part_count, ct_l, tr_id, m_size, exp, st, transport_type FROM (SELECT DISTINCT date_sent * 1 AS date_sent, date * 1 AS date_received, _id, body, read, thread_id, type, address, subject, NULL AS m_type, NULL AS msg_box, status, NULL AS part_count, NULL AS ct_l, NULL AS tr_id, NULL AS m_size, NULL AS exp, NULL AS st, 'sms' AS transport_type FROM sms WHERE (read = 0) UNION ALL SELECT DISTINCT date * 1000 AS date_sent, date_received * 1000 AS date_received, _id, body, read, thread_id, NULL AS type, address, NULL AS subject, m_type, msg_box, NULL AS status, part_count, ct_l, tr_id, m_size, exp, st, 'mms' AS transport_type FROM mms WHERE (read = 0) ORDER BY date_received ASC)
W/MmsSmsDatabase(23945): Executing query: SELECT _id, body, type, thread_id, address, subject, date_sent, date_received, m_type, msg_box, status, part_count, ct_l, tr_id, m_size, exp, st, transport_type FROM (SELECT DISTINCT date_sent * 1 AS date_sent, date * 1 AS date_received, _id, body, read, thread_id, type, address, subject, NULL AS m_type, NULL AS msg_box, status, NULL AS part_count, NULL AS ct_l, NULL AS tr_id, NULL AS m_size, NULL AS exp, NULL AS st, 'sms' AS transport_type FROM sms WHERE (thread_id = 72) UNION ALL SELECT DISTINCT date * 1000 AS date_sent, date_received * 1000 AS date_received, _id, body, read, thread_id, NULL AS type, address, NULL AS subject, m_type, msg_box, NULL AS status, part_count, ct_l, tr_id, m_size, exp, st, 'mms' AS transport_type FROM mms WHERE (thread_id = 72) ORDER BY date_received DESC) LIMIT 1
@satmandu Does the key exchange message you received on that device say "Received key exchange message, click to process?" It sounds like the identity key changed on the other device and you just haven't verified it yet.
It looks like there might have been a key caching issue from the previous time I tried. (Which is itself a bug? Are keys tied to phone number or device?)
I've now gotten key exchange working with two devices sans google voice. Now I'm going to try with gv enabled on one of these devices via voice+.
@satmandu , so the key exchange message did say click to process?
TextSecure identity keys are "trust on first use." So if a contact's identity key changes, TextSecure will warn you. This is not a bug.
moxie0, Is there a repository of old .apk's to try a .9 just for kicks?
@gotmailnow I can email you the APK.
moxie0, email sent.
What happens if you are traveling and get a new sim, with a new number? Would that mean "bad encrypted message" warnings for all messages, since you would have to setup new keys?
Since I'm switching between google voice and the native number on the same device, it seems that I have to "abort secure session" and do a new key exchange every time I switch back and forth. Is there a way to use a key from the same device for multiple numbers? (What if the numbers are part of the same contact?) The key is still passphrase protected anyways, right?
After some looking it appears that the original issue is due to google voice mangling the 160+ character key exchange message by adding a (i/n) header. The followup issue took place when I switched numbers, and then couldn't do a key exchange because of a cached key for the other number, I think. Maybe an option to notify of why that might be happening (key exists) might be useful. That or allowing a single key for multiple phone numbers.
@koush I think we're definitely hitting an issue where textsecure is sending a message that gets split into two google voice messages. Each message from google voice starts with (1/2) or (2/2), as opposed to normal sms that just sends a split message as two messages without the (i/n) header. So if gv+ can strip the (i/n) header in multipart messages of n messages where the message length for the first (n-1) messages is 160 + the characters for (i/n)... that should make the messages appear like regular sms messages. (Come to think of it... any message > 160 characters in gv+ should automatically flag as a multipart message.)
@satmandu Oh, yes, you are correct. On Voice+ i am reconstituting the multipart message into a single message, and sending it with one Google Voice call. This is incorrect, as then GV does the splitting server side. If I switch it back to sending the pre-split messages, that should fix the part denoting suffix.
@koush Thanks! I look forward to testing it out with a future nightly. ;-)
Thanks all. As the primary issue was with Voice+, I'd be happy to close this thread.
I flashed a updated stock OS 4.1.2, everything working fine now with TS. Must've been missing or outdated older ROM processes.