diff options
author | lookshe <github@lookshe.org> | 2016-02-16 11:41:54 +0100 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2016-02-16 11:41:54 +0100 |
commit | 1e40764b20a08170f8e4bfe1f1ae1559111f2961 (patch) | |
tree | 1791a3870361f37c3c34c299d075f56ed4a6e2c2 /src/main/java/eu/siacs/conversations/crypto | |
parent | a049aff638f27b68f08c753d42ef0fc2847b96cb (diff) | |
parent | d58d822215708cc0d9c841872abab448bf290e4c (diff) |
Merge tag '1.9.4' into trz/merge_1.9.4
Conflicts:
build.gradle
src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java
src/main/java/eu/siacs/conversations/parser/PresenceParser.java
src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
src/main/res/values/arrays.xml
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java | 25 |
1 files changed, 25 insertions, 0 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 43a90010..949975aa 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -1,5 +1,6 @@ package eu.siacs.conversations.crypto.axolotl; +import android.os.Bundle; import android.security.KeyChain; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -39,6 +40,7 @@ import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.parser.IqParser; import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.SerialSingleThreadExecutor; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; @@ -160,6 +162,20 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { AxolotlAddress axolotlAddress = new AxolotlAddress(bareJid, deviceId); Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Building session for remote address: " + axolotlAddress.toString()); IdentityKey identityKey = store.loadSession(axolotlAddress).getSessionState().getRemoteIdentityKey(); + if(Config.X509_VERIFICATION) { + X509Certificate certificate = store.getFingerprintCertificate(identityKey.getFingerprint().replaceAll("\\s", "")); + if (certificate != null) { + Bundle information = CryptoHelper.extractCertificateInformation(certificate); + try { + final String cn = information.getString("subject_cn"); + final Jid jid = Jid.fromString(bareJid); + Log.d(Config.LOGTAG,"setting common name for "+jid+" to "+cn); + account.getRoster().getContact(jid).setCommonName(cn); + } catch (final InvalidJidException ignored) { + //ignored + } + } + } this.put(axolotlAddress, new XmppAxolotlSession(account, store, axolotlAddress, identityKey)); } } @@ -619,6 +635,15 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { setFingerprintTrust(fingerprint, XmppAxolotlSession.Trust.TRUSTED_X509); axolotlStore.setFingerprintCertificate(fingerprint, verification.first[0]); fetchStatusMap.put(address, FetchStatus.SUCCESS_VERIFIED); + Bundle information = CryptoHelper.extractCertificateInformation(verification.first[0]); + try { + final String cn = information.getString("subject_cn"); + final Jid jid = Jid.fromString(address.getName()); + Log.d(Config.LOGTAG,"setting common name for "+jid+" to "+cn); + account.getRoster().getContact(jid).setCommonName(cn); + } catch (final InvalidJidException ignored) { + //ignored + } finishBuildingSessionsFromPEP(address); return; } catch (Exception e) { |