aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/crypto
diff options
context:
space:
mode:
authorChristian S <christian@pix-art.de>2015-09-12 10:27:21 +0200
committerChristian S <christian@pix-art.de>2015-09-12 10:27:21 +0200
commit07c1571e1eb32c1c36fe80bdb96caf17c3824dc4 (patch)
tree657fba8eebcc988c833a317834cdb30dddfd4b02 /src/main/java/eu/siacs/conversations/crypto
parentc90ca66c58c37836c13075c794b1e7cad3813984 (diff)
parent15d1623ec6f1fbf6af939a5d2403e3dcc7e6839f (diff)
Version 1.6.9
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java30
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java2
2 files changed, 25 insertions, 7 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 77c9d9d7e..df7f905b2 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
@@ -190,8 +190,8 @@ public class AxolotlService {
this.executor = new SerialSingleThreadExecutor();
}
- public IdentityKey getOwnPublicKey() {
- return axolotlStore.getIdentityKeyPair().getPublicKey();
+ public String getOwnFingerprint() {
+ return axolotlStore.getIdentityKeyPair().getPublicKey().getFingerprint().replaceAll("\\s", "");
}
public Set<IdentityKey> getKeysWithTrust(XmppAxolotlSession.Trust trust) {
@@ -222,11 +222,31 @@ public class AxolotlService {
return sessions;
}
+ public Set<String> getFingerprintsForOwnSessions() {
+ Set<String> fingerprints = new HashSet<>();
+ for (XmppAxolotlSession session : findOwnSessions()) {
+ fingerprints.add(session.getFingerprint());
+ }
+ return fingerprints;
+ }
+
+ public Set<String> getFingerprintsForContact(final Contact contact) {
+ Set<String> fingerprints = new HashSet<>();
+ for (XmppAxolotlSession session : findSessionsforContact(contact)) {
+ fingerprints.add(session.getFingerprint());
+ }
+ return fingerprints;
+ }
+
private boolean hasAny(Contact contact) {
AxolotlAddress contactAddress = getAddressForJid(contact.getJid());
return sessions.hasAny(contactAddress);
}
+ public boolean isPepBroken() {
+ return this.pepBroken;
+ }
+
public void regenerateKeys() {
axolotlStore.regenerate();
sessions.clear();
@@ -310,8 +330,8 @@ public class AxolotlService {
});
}
- public void purgeKey(IdentityKey identityKey) {
- axolotlStore.setFingerprintTrust(identityKey.getFingerprint().replaceAll("\\s", ""), XmppAxolotlSession.Trust.COMPROMISED);
+ public void purgeKey(final String fingerprint) {
+ axolotlStore.setFingerprintTrust(fingerprint.replaceAll("\\s", ""), XmppAxolotlSession.Trust.COMPROMISED);
}
public void publishOwnDeviceIdIfNeeded() {
@@ -536,8 +556,6 @@ public class AxolotlService {
bundle.getSignedPreKeyId(), bundle.getSignedPreKey(),
bundle.getSignedPreKeySignature(), bundle.getIdentityKey());
- axolotlStore.saveIdentity(address.getName(), bundle.getIdentityKey());
-
try {
SessionBuilder builder = new SessionBuilder(axolotlStore, address);
builder.process(preKeyBundle);
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java
index c4053854d..d582db40c 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java
@@ -91,7 +91,7 @@ public class XmppAxolotlSession {
public XmppAxolotlSession(Account account, SQLiteAxolotlStore store, AxolotlAddress remoteAddress, String fingerprint) {
this(account, store, remoteAddress);
- this.fingerprint = fingerprint;
+ this.fingerprint = fingerprint.replaceAll("\\s","");
}
public XmppAxolotlSession(Account account, SQLiteAxolotlStore store, AxolotlAddress remoteAddress) {