Commit Graph

110 Commits

Author SHA1 Message Date
Daniel Gultsch
212d1a8c91 add config variable to enable x509 verification 2015-10-12 13:18:20 +02:00
Daniel Gultsch
933538a39d code clean up 2015-10-12 12:36:54 +02:00
Daniel Gultsch
b519411d34 enable SASL EXTERNAL (certificate login 2015-10-11 20:45:01 +02:00
Daniel Gultsch
7be331bbb2 add menu item in account details to renew certificate 2015-10-11 16:10:52 +02:00
Andreas Straub
fdd88aa530 Clean up
Fixes some random linter warnings.
2015-10-11 16:05:44 +02:00
Daniel Gultsch
506b83ddc6 be more careful when publishing device bundle 2015-09-17 14:18:06 +02:00
Daniel Gultsch
eff173ebc2 indicate broken pep in server info 2015-09-06 19:40:28 +02:00
Andreas Straub
a95c451f1e Only show that have sessions in fingerprint list
Doesn't access database directly anymore but goes through AxolotlService
now to obtain list of fingerprints associated with an Account/Contact.
This should prevent orphaned keys littering the UI which previously
couldn't be removed through the Clear Devices function.

Together with 1c79982da84964c1d81179a0927d9cd1eadf53de this fixes #1393
2015-09-06 15:15:57 +02:00
Andreas Straub
2bb033267b Don't manually add keys to the store
There is no need to preemptively add the keys to the store oneself.
SessionBuilder will take care of this for us. What's more, this will
prevent IdentityKeys from otherwise invalid bundles to show up in our
UI.
2015-09-06 15:15:57 +02:00
Andreas Straub
e2d506c96a Never build a session with oneself
If we detect our own ID is not in our own devicelist on receiving an
update, we reannounce ourselves. This used to have the side effect of
modifying the list of devices we thought were in the update set, causing
us to accidentally build a session with ourselves.

This lead to our own key being set to TRUSTED_INACTIVE, resulting in red
lock icons on messages sent by the own device.

We fix this by having publishOwnDeviceId() operate on a copy of the
original set. This commit also includes a db migration which deletes
sessions with oneself and sets own keys back to TRUSTED.
2015-09-05 17:29:58 +02:00
Daniel Gultsch
91b0605bc2 use same method to add message hints to otr message everywhere it is needed 2015-09-01 22:36:56 +02:00
Andreas Straub
1156ccbce2 Fix error handling for announce check retrieval
Only aborts when a timeout was received. Error conditions (most notably
item-not-found) are interpreted as no other devices existing.
2015-08-26 20:52:44 +02:00
Andreas Straub
c4a548ada0 Only announce device after publishing bundle 2015-08-26 15:45:21 +02:00
Andreas Straub
0eeaccd974 Fix key publishing
Remove invalid check for result code, which prevented publishing if the
node was empty to begin with.

Fix pepBroken check
2015-08-26 00:27:39 +02:00
Andreas Straub
25a9d59412 Add more logging to pep attemp counter logic 2015-08-25 18:52:36 +02:00
Andreas Straub
eafcf38ec9 Limit number of PEP publish tries
If PEP publish tries are repeatedly triggered by empty PEP updates, stop
attempting to publish after 3 tries. This should work around broken PEP
implementations in older ejabberd and OpenFire versions.
2015-08-25 18:43:44 +02:00
Andreas Straub
b84fecf51a Pass through device IDs when updating own list 2015-08-25 12:17:09 +02:00
Daniel Gultsch
5eae1e52d2 cleared up some error messages in axolotl service and execute publishOwnDevicesWhenNeeded() only if processing our own jid 2015-08-25 11:43:10 +02:00
Andreas Straub
e1dc7f990d Add error handling to OMEMO PEP code
Log received errors and abort processing
2015-08-23 13:23:51 +02:00
Daniel Gultsch
c082066118 catch null pointer in ScramSHA1 sasl 2015-08-16 11:50:33 +02:00
Andreas Straub
7437d0fe0c Increase number of published prekeys for release 2015-08-07 12:30:39 +02:00
Andreas Straub
6cd9383e53 Let UNTRUSTED/UNDECIDED keys become INACTIVE 2015-08-01 18:30:11 +02:00
Andreas Straub
6059b96456 Provide process function for key transport message 2015-07-31 23:28:09 +02:00
Andreas Straub
909f761ca1 Refactor axolotl message processing workflow
XmppAxolotlMessage is now entirely responsible for handling encryption
and decryption of messages, only leveraging XmppAxolotlSession as a
packing/unpacking primitive for payload keys.

Removed pseudo-dead session generation code step from prepareMessage
function, as sessions have been created by invoking the
TrustKeysActivity for a while now.

Added prepareKeyTransportMessage function, which creates a message with
no payload. The key that is packed into the header keyElements can then
be used for other purposes (e.g. encrypted file transfer).
2015-07-31 21:31:45 +02:00
Andreas Straub
50b14434ee Reformat code 2015-07-31 21:31:45 +02:00
Andreas Straub
5c421da1e1 Change to new wire protocol version 2015-07-31 21:31:45 +02:00
Andreas Straub
e10a6c5b87 Fix NPE: consider unknown keys UNDECIDED 2015-07-29 02:59:41 +02:00
Andreas Straub
efcefc2e63 Refactor out inner classes, cache trust store
Moves SQLiteAxolotlStore and XmppAxolotlSession into proper classes.

IdentityKeys trust statuses are now cached in an LruCache to prevent
hammering the database when rendering the UI.
2015-07-29 02:59:26 +02:00
Andreas Straub
db05d26433 Always build own device session automatically 2015-07-22 15:03:52 +02:00
Andreas Straub
92b5081b5e Add INACTIVE state for removed keys
We introduce a new trust state: INACTIVE. This state is intended for
old keys that have been removed.

When a TRUSTED device is removed from the PEP devicelist, it's status
will be set to INACTIVE. INACTIVE keys are shown in the UI as greyed
out, non-interactible key rows. Messages are not encrypted for INACTIVE
devices.

When an INACTIVE device reappears in PEP, or a message is received from
an INACTIVE device, it is set back to trusted.
2015-07-21 14:24:59 +02:00
Andreas Straub
3c5c0c7d3b Fill own device sessions into SessionMap 2015-07-21 14:24:59 +02:00
Daniel Gultsch
ffa588ba3e and now do that properly 2015-07-21 12:01:20 +02:00
Daniel Gultsch
a5027104fd bugfix: also add no-permanent-storage to message hints 2015-07-21 11:50:32 +02:00
Andreas Straub
b7ff2c3461 Use properly fixed numeral values in Trust enum
Why, oh God, why?! #thanksjamesgosling
2015-07-21 01:52:22 +02:00
Andreas Straub
639ebd644b Remove unused import 2015-07-21 01:17:29 +02:00
Andreas Straub
122bc97ce2 Switch payload encryption to AES-GCM
This also ensures that the IV is generated with proper randomness.
2015-07-21 01:17:14 +02:00
Andreas Straub
971aa3a11e Also decrypt messages from UNTRUSTED sessions 2015-07-20 23:16:06 +02:00
Andreas Straub
d2845e9ac1 Refactor axolotl send processing/caching flow 2015-07-20 23:13:28 +02:00
Andreas Straub
8be0e8a27d Start TrustKeysActivity if no keys are TRUSTED
If there are no UNDECIDED keys, but none of the contact's keys are
trusted, redirect the user to the TrustKeysActivity
2015-07-20 22:35:07 +02:00
Andreas Straub
ab2d114bbc Add purge axolotl key option
Can now long-press a key to permanently purge it.
2015-07-20 22:18:24 +02:00
Daniel Gultsch
e79f82ca72 attempt to fix the delay problem 2015-07-20 18:11:33 +02:00
Andreas Straub
19a0ae42d6 Lock TrustKeys if no trusted keys are available 2015-07-20 14:56:41 +02:00
Andreas Straub
012f036840 Optimize imports 2015-07-20 14:26:29 +02:00
Andreas Straub
14010bf5a6 Ask for key trust when sending messages
If the contact (or the own account) has keys that have UNDECIDED trust,
we now drop the user into the new TrustKeysActivity, where they have to
decide for each new key whether it should be TRUSTED or UNTRUSTED.
2015-07-19 22:27:26 +02:00
Andreas Straub
9c4d55f82c Send correct body for HTTP files
When using HTTP upload to send files, take care to transmit only the URL
rather than the entire body, which contains metadata.
2015-07-19 22:23:28 +02:00
Andreas Straub
4038af2f47 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
35714d3d08 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
461d0446f7 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
d173913eba 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
f1d73b9d4e Use full int range for device IDs 2015-07-19 22:17:57 +02:00