Commit graph

2661 commits

Author SHA1 Message Date
Andreas Straub
a01f660eab Fix trust status for outgoing messages
Tag sent messages with own fingerprint, set own fingerprint as always
trusted, include own fingerprint in database trust search, explicitly
reset trust colorfilter
2015-07-19 22:23:28 +02:00
Andreas Straub
2ba6c79c5b Don't merge messages with different trust statuses 2015-07-19 22:23:28 +02:00
Sam Whited
aeeb0c05b7 Fix copying of axolotl keys to clipboard 2015-07-19 22:23:28 +02:00
Sam Whited
825fe15573 Add refresh icon to v21 theme 2015-07-19 22:23:27 +02:00
Andreas Straub
f95a18c027 Disable Axolotl option if not usable
In MUCs or if contact is not axolotl capable, disable axolotl menu
option
2015-07-19 22:23:27 +02:00
Andreas Straub
acbd8106c4 Show trust status of messages' originating session
Shade lock icon red if message was received in a session that has not
been marked trusted by the user or fingerprint is unknown
2015-07-19 22:23:27 +02:00
Andreas Straub
8873f46187 Add key trust toggle to ContactDetailsActivity
Can now toggle IdentityKey trust
2015-07-19 22:23:27 +02:00
Andreas Straub
c47fb3b794 Ensure that available sessions are always used
Any time a new session is established, call syncRosterToDisk() to ensure
that on subsequent restoreFromDatabase() calls, the roster is actually
available. This is important so that initAccountServices() can properly
initialize the SessionMap. This prevents a race condition where after
adding a new account and initiating sessions with it, if the app is
killed (e.g. by reinstall) before triggering a syncRosterToDisk(),
subsequent restores will not have the roster available, leading to
missing XmppAxolotlSessions in the SessionMap cache. As a result of
this, a new session was initiated when sending a new message, and
received messages could not be tagged with the originating session's
fingerprint.

As an added sanity check, go to the database to confirm no records are
present before creating fresh XmppAxolotlSession objects (both in the
sending and receiving case).
2015-07-19 22:23:27 +02:00
Andreas Straub
34701c4ddd Fix setIdentityKeyTrust update statement 2015-07-19 22:23:27 +02:00
Andreas Straub
ed59944c29 Fix IdentityKey storage model
Added proper UNIQUE statement
2015-07-19 22:23:27 +02:00
Andreas Straub
a7ba7a4e58 Fix and expand key regeneration function
Wipe session cache to prevent stale sessions being used. Wipe fetch
status cache to enable recreation of sessions. Regenerate deviceId, so
that foreign devices will talk to us again.
2015-07-19 22:23:27 +02:00
Andreas Straub
2fdfa1ac86 Display trust status in ContactDetailsActivity 2015-07-19 22:23:25 +02:00
Andreas Straub
1b9a33e719 Overhauled Message tagging
Messages are now tagged with the IdentityKey fingerprint of the
originating session. IdentityKeys have one of three trust states:
undecided (default), trusted, and untrusted/not yet trusted.
2015-07-19 22:17:58 +02:00
Andreas Straub
305cd2424e Postpone initAccountService until roster loaded
The AxolotlService depends on the roster being loaded when it is
initialized so that it can fill its in-memory SessionMap.
2015-07-19 22:17:57 +02:00
Andreas Straub
0bf8064c49 Fix getSubDeviceSessions SQL query 2015-07-19 22:17:57 +02:00
Andreas Straub
101ce5c626 Display axolotl chat message hint 2015-07-19 22:17:57 +02:00
Andreas Straub
3b5f8377a1 Use full int range for device IDs 2015-07-19 22:17:57 +02:00
Andreas Straub
f40a3f1bf7 Clean up unused constant 2015-07-19 22:17:57 +02:00
Andreas Straub
f92fac3d59 Make some fields final 2015-07-19 22:17:57 +02:00
Andreas Straub
f4c328b745 Clean up logging
Add a fixed prefix to axolotl-related log messages, set log levels
sensibly.
2015-07-19 22:17:57 +02:00
Andreas Straub
5520d2ad61 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-19 22:17:55 +02:00
Christian S
26dc153339 show contact details in conference details ... 2015-07-19 22:11:51 +02:00
Andreas Straub
874304b840 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-19 21:32:27 +02:00
Andreas Straub
9ede85bc22 Refactor axolotl database recreation 2015-07-19 21:32:27 +02:00
Andreas Straub
b09450c55a Adapt prettifyFingerprint() to axolotl FP sizes 2015-07-19 21:32:27 +02:00
Andreas Straub
06e9758c12 Fix displaying Contact IdentityKeys
Migrate ContactDetailsActivity to use new SQL IdentityKeys storage,
remove dead code from Contact class.
2015-07-19 21:32:27 +02:00
Andreas Straub
f798bf1531 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-19 21:32:27 +02:00
Andreas Straub
347ec8e1c6 Return empty set on invalid PEP devicelist 2015-07-19 21:32:27 +02:00
Andreas Straub
0774f4fcdb 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-19 21:32:27 +02:00
Andreas Straub
2bd69f963c 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-19 21:32:27 +02:00
Andreas Straub
93ba143e9d 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-19 21:32:27 +02:00
Andreas Straub
b9cd999bdb 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-19 21:32:27 +02:00
Andreas Straub
32ad43bb2f 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-19 21:32:27 +02:00
Andreas Straub
4453b001c4 Formatting fixes 2015-07-19 21:32:27 +02:00
Andreas Straub
4ac3462a14 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-19 21:32:26 +02:00
Andreas Straub
7069a5ba2f Tag messages with originating session
This can be used later in order to display trust status of messages, as
well as for potential resending of messages in case of preKey conflicts.
2015-07-19 21:32:26 +02:00
Andreas Straub
4f05a1423c 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-19 21:32:26 +02:00
Andreas Straub
a599838434 Use bareJid for own session retrieval 2015-07-19 21:32:26 +02:00
Andreas Straub
1b26a12185 Migrate to new PEP layout
Merge prekeys into bundle node
2015-07-19 21:32:26 +02:00
Andreas Straub
4c3867bf49 Formatting fixes 2015-07-19 21:32:26 +02:00
Andreas Straub
a2513ed40d Save IdentityKeys in database 2015-07-19 21:32:26 +02:00
Andreas Straub
b6708df9bc DatabaseBackend bugfixes
Don't leak cursors, initially create tables
2015-07-19 21:32:26 +02:00
Andreas Straub
c5796962c5 Reformat code to use tabs
This really sucks to do it like this. Sorry. :(
2015-07-19 21:32:26 +02:00
Andreas Straub
3ec2a2a458 Added axolotl activation code to UI 2015-07-19 21:32:26 +02:00
Andreas Straub
1124e65a8f Added PEP and message protocol layers
Can now fetch/retrieve from PEP, as well as encode/decode messages
2015-07-19 21:32:26 +02:00
Andreas Straub
11c7ce715b Reworked axolotl protocol layer
Numerous fixes
2015-07-19 21:32:25 +02:00
Andreas Straub
e1d34dee74 CryptoNext Menu entries added 2015-07-19 21:32:25 +02:00
Andreas Straub
a10291c6a7 CryptoNext persistance layer mockup
Initial sketch of the peripheral storage infrastructure for the new
axolotl-based encryption scheme.
2015-07-19 21:32:21 +02:00
Daniel Gultsch
de20b5ef34 shut up linter 2015-07-19 14:51:11 +02:00
Daniel Gultsch
ad0050e8ec bugfix: don't crash if aes key could not be set before jingle transfer 2015-07-19 14:51:04 +02:00