diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-12-08 17:15:08 +0100 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2015-12-12 15:50:06 +0100 |
commit | 00e8d9c4771ad9cfa18d26709d2e7ba6883dd2ad (patch) | |
tree | f0082fddc5548530a04285dd2101929fa427b5be | |
parent | a58d0f5eb26af7407475812fca245b93dbcdc069 (diff) |
also verify sessions in CBE mode that got created by key transport messages
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index 2aaadab71..a3dc1357e 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -924,7 +924,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { } if (session.isFresh() && plaintextMessage != null) { - sessions.put(session); + putFreshSession(session); } return plaintextMessage; @@ -937,9 +937,21 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { keyTransportMessage = message.getParameters(session, getOwnDeviceId()); if (session.isFresh() && keyTransportMessage != null) { - sessions.put(session); + putFreshSession(session); } return keyTransportMessage; } + + private void putFreshSession(XmppAxolotlSession session) { + sessions.put(session); + if (Config.X509_VERIFICATION) { + IdentityKey identityKey = axolotlStore.loadSession(session.getRemoteAddress()).getSessionState().getRemoteIdentityKey(); + if (identityKey != null) { + verifySessionWithPEP(session, identityKey); + } else { + Log.e(Config.LOGTAG,account.getJid().toBareJid()+": identity key was empty after reloading for x509 verification"); + } + } + } } |