diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-06-25 19:18:07 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-06-25 19:18:07 +0200 |
commit | 38880f2a15cde3d21c597e2d69b76c69febb3eff (patch) | |
tree | 2d13502af4109130c1944c1023ec2c58e9a1cc73 /src/main/java/de/pixart/messenger/crypto/axolotl | |
parent | eb7e41ceba16810a7e7c54bba26226b3c2bb24eb (diff) |
fixed fingerprint trust (was messed up after library upgrade)
Diffstat (limited to 'src/main/java/de/pixart/messenger/crypto/axolotl')
-rw-r--r-- | src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/crypto/axolotl/SQLiteAxolotlStore.java | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java index c53ec40fe..b444349b2 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -188,7 +188,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { SignalProtocolAddress axolotlAddress = new SignalProtocolAddress(bareJid, deviceId); IdentityKey identityKey = store.loadSession(axolotlAddress).getSessionState().getRemoteIdentityKey(); if (Config.X509_VERIFICATION) { - X509Certificate certificate = store.getFingerprintCertificate(identityKey.getFingerprint().replaceAll("\\s", "")); + X509Certificate certificate = store.getFingerprintCertificate(CryptoHelper.bytesToHex(identityKey.getPublicKey().serialize())); if (certificate != null) { Bundle information = CryptoHelper.extractCertificateInformation(certificate); try { @@ -887,7 +887,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { if (Config.X509_VERIFICATION) { verifySessionWithPEP(session); } else { - FingerprintStatus status = getFingerprintTrust(bundle.getIdentityKey().getFingerprint().replaceAll("\\s", "")); + FingerprintStatus status = getFingerprintTrust(CryptoHelper.bytesToHex(bundle.getIdentityKey().getPublicKey().serialize())); FetchStatus fetchStatus; if (status != null && status.isVerified()) { fetchStatus = FetchStatus.SUCCESS_VERIFIED; diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/SQLiteAxolotlStore.java b/src/main/java/de/pixart/messenger/crypto/axolotl/SQLiteAxolotlStore.java index 3c5ddd3db..748f9f6d9 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/SQLiteAxolotlStore.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/SQLiteAxolotlStore.java @@ -3,15 +3,15 @@ package de.pixart.messenger.crypto.axolotl; import android.util.Log; import android.util.LruCache; -import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.InvalidKeyIdException; +import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.ecc.Curve; import org.whispersystems.libsignal.ecc.ECKeyPair; -import org.whispersystems.libsignal.state.SignalProtocolStore; import org.whispersystems.libsignal.state.PreKeyRecord; import org.whispersystems.libsignal.state.SessionRecord; +import org.whispersystems.libsignal.state.SignalProtocolStore; import org.whispersystems.libsignal.state.SignedPreKeyRecord; import org.whispersystems.libsignal.util.KeyHelper; @@ -22,6 +22,7 @@ import java.util.Set; import de.pixart.messenger.Config; import de.pixart.messenger.entities.Account; import de.pixart.messenger.services.XmppConnectionService; +import de.pixart.messenger.utils.CryptoHelper; public class SQLiteAxolotlStore implements SignalProtocolStore { @@ -186,7 +187,7 @@ public class SQLiteAxolotlStore implements SignalProtocolStore { @Override public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) { if (!mXmppConnectionService.databaseBackend.loadIdentityKeys(account, address.getName()).contains(identityKey)) { - String fingerprint = identityKey.getFingerprint().replaceAll("\\s", ""); + String fingerprint = CryptoHelper.bytesToHex(identityKey.getPublicKey().serialize()); FingerprintStatus status = getFingerprintStatus(fingerprint); if (status == null) { if (mXmppConnectionService.blindTrustBeforeVerification() && !account.getAxolotlService().hasVerifiedKeys(address.getName())) { |