Commit Graph

23 Commits

Author SHA1 Message Date
Andreas Straub 6b0d286518 Clean up unused constant 2015-07-08 17:46:03 +02:00
Andreas Straub 9e3419722b Make some fields final 2015-07-08 17:45:37 +02:00
Andreas Straub 4f6ca6fb63 Clean up logging
Add a fixed prefix to axolotl-related log messages, set log levels
sensibly.
2015-07-08 17:44:24 +02:00
Andreas Straub d5b3557157 Add basic PEP managemend UI to EditAccountActivity
EditAccountActivity now show own fingerprint, and gives an option to
regenerate local keying material (and wipe all sessions associated with
the old keys in the process).

It also now displays a list of other own devices, and gives an option to
remove all but the current device.
2015-07-07 19:36:22 +02:00
Andreas Straub 9d780a382a Fix devicelist update handling
No longer store own device ID (so that we don't encrypt messages for
ourselves), verify that own device ID is present in update list
(otherwise republish), reflect update in UI.
2015-07-07 19:32:52 +02:00
Andreas Straub 3b8dfafecd Only cache session if successfully established
When receiving a message, only remember the XmppAxolotlSession wrapper
if the prospective session was actually established. This prevents us
from erroneously adding empty sessions that are never established using
received PreKeyWhisperMessages, which would lead to errors if we try to
use them for sending.
2015-07-05 22:54:28 +02:00
Andreas Straub 835584ae3b Return empty set on invalid PEP devicelist 2015-07-05 22:53:34 +02:00
Andreas Straub 4cc4e81b8e Trust all IdentityKeys
The trust-on-first-use policy leads to problems when receiving messages
from two different devices of a contact before sending a message to them
(as their IdentityKeys will not have been added yet). Since session
trust will be managed externally anyway, this change is not a security
problem, and will allow us to decrypt messages from yet-untrusted
sessions.
2015-07-05 22:10:43 +02:00
Andreas Straub 72619de889 Refresh PEP on session establish
We now track preKeys used to establish incoming sessions with us. On
each new established session, we remove the used prekey from PEP. We
have to do this because libaxolotl-java internally clears the used
preKey from its storage, so we will not be able to establish any future
sessions using that key.
2015-07-05 17:27:29 +02:00
Andreas Straub 12fc24dd42 Fix asynchronous axolotl message sending
XmppConnectionService.sendMessage() now dispatches messages to the
AxolotlService, where they only are prepared for sending and cached.
AxolotlService now triggers a XmppConnectionService.resendMessage(),
which then handles sending the cached message packet.

This transparently fixes, e.g., handling of messages sent while we are
offline.
2015-07-05 17:27:29 +02:00
Andreas Straub c5596b34bc Properly track message sender
Previously, the sender was assumed to be the conversation counterpart.
This broke carboned own-device messages. We now track the sender
properly, and also set the status (sent by one of the own devices vs
received from the counterpart) accordingly.
2015-07-05 17:27:29 +02:00
Andreas Straub 9206a49b79 Rework PEP content verification
Now checks which part(s) are out of sync w/ local storage, and updates
only those, rather than assuming the entire node corrupt and
overwriting it all (especially relevant for preKey list)
2015-07-05 17:27:29 +02:00
Andreas Straub 7680a24180 Formatting fixes 2015-07-05 17:27:29 +02:00
Andreas Straub c1116b6066 When receiving, add mock session if none exists
We need a session object in order to build a session from a
PreKeyWhisperMessage, so add an empty one when none exists on receiving
a message.

Warning: this will break right now if the session can not be constructed
from the received message.There will be an invalid session which will
break if we try to send using it.
2015-07-05 17:27:29 +02:00
Andreas Straub a58d5e8ce3 Fetch bundles on-demand, encrypt in background
Bundles are now fetched on demand when a session needs to be
established. This should lessen the chance of changes to the bundles
occuring before they're used, as well as lessen the load of fetching
bundles.

Also, the message encryption is now done in a background thread, as this
can be somewhat costly if many sessions are present. This is probably
not going to be an issue in real use, but it's good practice anyway.
2015-07-05 17:27:22 +02:00
Andreas Straub ae75c571df Use bareJid for own session retrieval 2015-07-05 17:26:29 +02:00
Andreas Straub ba9520729f Migrate to new PEP layout
Merge prekeys into bundle node
2015-07-05 17:26:29 +02:00
Andreas Straub 287ce131d8 Formatting fixes 2015-07-05 17:26:29 +02:00
Andreas Straub 046a2d6045 Save IdentityKeys in database 2015-07-05 17:26:29 +02:00
Andreas Straub 0423852cb8 Reformat code to use tabs
This really sucks to do it like this. Sorry. :(
2015-07-05 17:26:29 +02:00
Andreas Straub 61f18d4dfc Added PEP and message protocol layers
Can now fetch/retrieve from PEP, as well as encode/decode messages
2015-07-05 17:14:46 +02:00
Andreas Straub 6805abbef0 Reworked axolotl protocol layer
Numerous fixes
2015-07-05 17:09:35 +02:00
Andreas Straub f16b77d382 CryptoNext persistance layer mockup
Initial sketch of the peripheral storage infrastructure for the new
axolotl-based encryption scheme.
2015-07-05 17:09:34 +02:00