also verify sessions in CBE mode that got created by key transport messages

This commit is contained in:
Daniel Gultsch 2015-12-08 17:15:08 +01:00
parent b9fc7ebe24
commit 1de74c2337
1 changed files with 14 additions and 2 deletions

View File

@ -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");
}
}
}
}