mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Migrate from libsignal-protocol-java to libsignal
This commit is contained in:
parent
19b20fefec
commit
8d657db561
11 changed files with 172 additions and 122 deletions
|
@ -6,8 +6,7 @@ dependencies {
|
||||||
api project(":smack-im")
|
api project(":smack-im")
|
||||||
api project(":smack-extensions")
|
api project(":smack-extensions")
|
||||||
api project(":smack-omemo")
|
api project(":smack-omemo")
|
||||||
implementation 'org.whispersystems:signal-protocol-java:2.6.2'
|
implementation 'org.signal:libsignal-client:0.26.0'
|
||||||
|
|
||||||
testFixturesApi(testFixtures(project(":smack-core")))
|
testFixturesApi(testFixtures(project(":smack-core")))
|
||||||
testImplementation project(path: ":smack-omemo", configuration: "testRuntime")
|
testImplementation project(path: ":smack-omemo", configuration: "testRuntime")
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,15 @@ package org.jivesoftware.smackx.omemo.signal;
|
||||||
import org.jivesoftware.smackx.omemo.CachingOmemoStore;
|
import org.jivesoftware.smackx.omemo.CachingOmemoStore;
|
||||||
import org.jivesoftware.smackx.omemo.OmemoStore;
|
import org.jivesoftware.smackx.omemo.OmemoStore;
|
||||||
|
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the CachingOmemoStore for smack-omemo-signal.
|
* Implementation of the CachingOmemoStore for smack-omemo-signal.
|
||||||
|
|
|
@ -25,15 +25,15 @@ import java.io.File;
|
||||||
import org.jivesoftware.smackx.omemo.FileBasedOmemoStore;
|
import org.jivesoftware.smackx.omemo.FileBasedOmemoStore;
|
||||||
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
||||||
|
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of a FileBasedOmemoStore for the smack-omemo-signal module.
|
* Implementation of a FileBasedOmemoStore for the smack-omemo-signal module.
|
||||||
|
|
|
@ -20,26 +20,28 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.omemo.signal;
|
package org.jivesoftware.smackx.omemo.signal;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import org.jivesoftware.smackx.omemo.element.OmemoBundleElement;
|
import org.jivesoftware.smackx.omemo.element.OmemoBundleElement;
|
||||||
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||||
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
||||||
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
|
import org.signal.libsignal.protocol.InvalidKeyException;
|
||||||
|
import org.signal.libsignal.protocol.InvalidMessageException;
|
||||||
|
import org.signal.libsignal.protocol.ecc.Curve;
|
||||||
|
import org.signal.libsignal.protocol.ecc.ECKeyPair;
|
||||||
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
import org.signal.libsignal.protocol.util.Medium;
|
||||||
|
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import java.io.IOException;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import java.util.LinkedList;
|
||||||
import org.whispersystems.libsignal.InvalidKeyException;
|
import java.util.List;
|
||||||
import org.whispersystems.libsignal.ecc.Curve;
|
import java.util.TreeMap;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
|
||||||
import org.whispersystems.libsignal.util.KeyHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of the KeyUtil for an implementation using the Signal library.
|
* Concrete implementation of the KeyUtil for an implementation using the Signal library.
|
||||||
|
@ -51,12 +53,12 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IdentityKeyPair generateOmemoIdentityKeyPair() {
|
public IdentityKeyPair generateOmemoIdentityKeyPair() {
|
||||||
return KeyHelper.generateIdentityKeyPair();
|
return IdentityKeyPair.generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TreeMap<Integer, PreKeyRecord> generateOmemoPreKeys(int currentPreKeyId, int count) {
|
public TreeMap<Integer, PreKeyRecord> generateOmemoPreKeys(int currentPreKeyId, int count) {
|
||||||
List<PreKeyRecord> preKeyRecords = KeyHelper.generatePreKeys(currentPreKeyId, count);
|
List<PreKeyRecord> preKeyRecords = generatePreKeys(currentPreKeyId, count);
|
||||||
TreeMap<Integer, PreKeyRecord> map = new TreeMap<>();
|
TreeMap<Integer, PreKeyRecord> map = new TreeMap<>();
|
||||||
for (PreKeyRecord p : preKeyRecords) {
|
for (PreKeyRecord p : preKeyRecords) {
|
||||||
map.put(p.getId(), p);
|
map.put(p.getId(), p);
|
||||||
|
@ -64,20 +66,43 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<PreKeyRecord> generatePreKeys(int start, int count) {
|
||||||
|
List<PreKeyRecord> results = new LinkedList<>();
|
||||||
|
|
||||||
|
start--;
|
||||||
|
|
||||||
|
for (int i=0;i<count;i++) {
|
||||||
|
results.add(new PreKeyRecord(((start + i) % (Medium.MAX_VALUE-1)) + 1, Curve.generateKeyPair()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SignedPreKeyRecord generateOmemoSignedPreKey(IdentityKeyPair identityKeyPair, int currentPreKeyId)
|
public SignedPreKeyRecord generateOmemoSignedPreKey(IdentityKeyPair identityKeyPair, int currentPreKeyId)
|
||||||
throws CorruptedOmemoKeyException {
|
throws CorruptedOmemoKeyException {
|
||||||
try {
|
try {
|
||||||
return KeyHelper.generateSignedPreKey(identityKeyPair, currentPreKeyId);
|
return generateSignedPreKey(identityKeyPair, currentPreKeyId);
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
throw new CorruptedOmemoKeyException(e);
|
throw new CorruptedOmemoKeyException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static SignedPreKeyRecord generateSignedPreKey(IdentityKeyPair identityKeyPair, int signedPreKeyId) throws InvalidKeyException {
|
||||||
|
ECKeyPair keyPair = Curve.generateKeyPair();
|
||||||
|
byte[] signature = Curve.calculateSignature(identityKeyPair.getPrivateKey(), keyPair.getPublicKey().serialize());
|
||||||
|
|
||||||
|
return new SignedPreKeyRecord(signedPreKeyId, System.currentTimeMillis(), keyPair, signature);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SignedPreKeyRecord signedPreKeyFromBytes(byte[] data) throws IOException {
|
public SignedPreKeyRecord signedPreKeyFromBytes(byte[] data) throws IOException {
|
||||||
if (data == null) return null;
|
if (data == null) return null;
|
||||||
|
try {
|
||||||
return new SignedPreKeyRecord(data);
|
return new SignedPreKeyRecord(data);
|
||||||
|
} catch (InvalidMessageException e) {
|
||||||
|
throw new IOException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -88,7 +113,11 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
||||||
@Override
|
@Override
|
||||||
public SessionRecord rawSessionFromBytes(byte[] data) throws IOException {
|
public SessionRecord rawSessionFromBytes(byte[] data) throws IOException {
|
||||||
if (data == null) return null;
|
if (data == null) return null;
|
||||||
|
try {
|
||||||
return new SessionRecord(data);
|
return new SessionRecord(data);
|
||||||
|
} catch (InvalidMessageException e) {
|
||||||
|
throw new IOException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,11 +128,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
||||||
@Override
|
@Override
|
||||||
public IdentityKeyPair identityKeyPairFromBytes(byte[] data) throws CorruptedOmemoKeyException {
|
public IdentityKeyPair identityKeyPairFromBytes(byte[] data) throws CorruptedOmemoKeyException {
|
||||||
if (data == null) return null;
|
if (data == null) return null;
|
||||||
try {
|
|
||||||
return new IdentityKeyPair(data);
|
return new IdentityKeyPair(data);
|
||||||
} catch (InvalidKeyException e) {
|
|
||||||
throw new CorruptedOmemoKeyException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,7 +159,11 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
||||||
@Override
|
@Override
|
||||||
public PreKeyRecord preKeyFromBytes(byte[] bytes) throws IOException {
|
public PreKeyRecord preKeyFromBytes(byte[] bytes) throws IOException {
|
||||||
if (bytes == null) return null;
|
if (bytes == null) return null;
|
||||||
|
try {
|
||||||
return new PreKeyRecord(bytes);
|
return new PreKeyRecord(bytes);
|
||||||
|
} catch (InvalidMessageException e) {
|
||||||
|
throw new IOException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -187,7 +216,11 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] preKeyForBundle(PreKeyRecord preKeyRecord) {
|
public byte[] preKeyForBundle(PreKeyRecord preKeyRecord) {
|
||||||
|
try {
|
||||||
return preKeyRecord.getKeyPair().getPublicKey().serialize();
|
return preKeyRecord.getKeyPair().getPublicKey().serialize();
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,26 +35,27 @@ import org.jivesoftware.smackx.omemo.exceptions.UntrustedOmemoIdentityException;
|
||||||
import org.jivesoftware.smackx.omemo.internal.CiphertextTuple;
|
import org.jivesoftware.smackx.omemo.internal.CiphertextTuple;
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
|
|
||||||
import org.whispersystems.libsignal.DuplicateMessageException;
|
import org.signal.libsignal.protocol.DuplicateMessageException;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.InvalidKeyException;
|
import org.signal.libsignal.protocol.InvalidKeyException;
|
||||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
import org.signal.libsignal.protocol.InvalidKeyIdException;
|
||||||
import org.whispersystems.libsignal.InvalidMessageException;
|
import org.signal.libsignal.protocol.InvalidMessageException;
|
||||||
import org.whispersystems.libsignal.InvalidVersionException;
|
import org.signal.libsignal.protocol.InvalidVersionException;
|
||||||
import org.whispersystems.libsignal.LegacyMessageException;
|
import org.signal.libsignal.protocol.LegacyMessageException;
|
||||||
import org.whispersystems.libsignal.NoSessionException;
|
import org.signal.libsignal.protocol.NoSessionException;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.UntrustedIdentityException;
|
import org.signal.libsignal.protocol.UntrustedIdentityException;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.protocol.CiphertextMessage;
|
import org.signal.libsignal.protocol.message.CiphertextMessage;
|
||||||
import org.whispersystems.libsignal.protocol.PreKeySignalMessage;
|
import org.signal.libsignal.protocol.message.PreKeySignalMessage;
|
||||||
import org.whispersystems.libsignal.protocol.SignalMessage;
|
import org.signal.libsignal.protocol.message.SignalMessage;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
|
|
||||||
public class SignalOmemoRatchet
|
public class SignalOmemoRatchet
|
||||||
extends OmemoRatchet<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord, SessionRecord,
|
extends OmemoRatchet<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord, SessionRecord,
|
||||||
|
@ -103,7 +104,7 @@ public class SignalOmemoRatchet
|
||||||
catch (UntrustedIdentityException e) {
|
catch (UntrustedIdentityException e) {
|
||||||
throw new AssertionError("Signals trust management MUST be disabled.");
|
throw new AssertionError("Signals trust management MUST be disabled.");
|
||||||
}
|
}
|
||||||
catch (LegacyMessageException | InvalidKeyException e) {
|
catch (InvalidKeyException e) {
|
||||||
throw new CryptoFailedException(e);
|
throw new CryptoFailedException(e);
|
||||||
}
|
}
|
||||||
catch (InvalidKeyIdException e) {
|
catch (InvalidKeyIdException e) {
|
||||||
|
@ -134,7 +135,15 @@ public class SignalOmemoRatchet
|
||||||
LOGGER.log(Level.INFO, "Decryption of SignalMessage from " + sender +
|
LOGGER.log(Level.INFO, "Decryption of SignalMessage from " + sender +
|
||||||
" failed, since the message has been decrypted before.");
|
" failed, since the message has been decrypted before.");
|
||||||
return null;
|
return null;
|
||||||
|
} catch (InvalidVersionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
} catch (LegacyMessageException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decryptedKey;
|
return decryptedKey;
|
||||||
|
@ -156,7 +165,7 @@ public class SignalOmemoRatchet
|
||||||
}
|
}
|
||||||
|
|
||||||
private SessionCipher getCipher(OmemoDevice device) {
|
private SessionCipher getCipher(OmemoDevice device) {
|
||||||
return new SessionCipher(storeConnector, storeConnector, storeConnector, storeConnector,
|
return new SessionCipher(storeConnector, storeConnector, storeConnector, null, storeConnector,
|
||||||
SignalOmemoStoreConnector.asAddress(device));
|
SignalOmemoStoreConnector.asAddress(device));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,17 +28,19 @@ import org.jivesoftware.smackx.omemo.OmemoStore;
|
||||||
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
||||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
|
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.SessionBuilder;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.SessionBuilder;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.UntrustedIdentityException;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.UntrustedIdentityException;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of the OmemoService using the Signal library.
|
* Concrete implementation of the OmemoService using the Signal library.
|
||||||
|
@ -103,7 +105,7 @@ public final class SignalOmemoService
|
||||||
try {
|
try {
|
||||||
builder.process(contactsBundle);
|
builder.process(contactsBundle);
|
||||||
LOGGER.log(Level.FINE, "Session built with " + contactsDevice);
|
LOGGER.log(Level.FINE, "Session built with " + contactsDevice);
|
||||||
} catch (org.whispersystems.libsignal.InvalidKeyException e) {
|
} catch (org.signal.libsignal.protocol.InvalidKeyException e) {
|
||||||
throw new CorruptedOmemoKeyException(e);
|
throw new CorruptedOmemoKeyException(e);
|
||||||
} catch (UntrustedIdentityException e) {
|
} catch (UntrustedIdentityException e) {
|
||||||
// This should never happen.
|
// This should never happen.
|
||||||
|
|
|
@ -23,15 +23,15 @@ package org.jivesoftware.smackx.omemo.signal;
|
||||||
import org.jivesoftware.smackx.omemo.OmemoStore;
|
import org.jivesoftware.smackx.omemo.OmemoStore;
|
||||||
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
||||||
|
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the OmemoStore using the Signal library.
|
* Implementation of the OmemoStore using the Signal library.
|
||||||
|
|
|
@ -35,20 +35,22 @@ import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||||
import org.jxmpp.jid.BareJid;
|
import org.jxmpp.jid.BareJid;
|
||||||
import org.jxmpp.jid.impl.JidCreate;
|
import org.jxmpp.jid.impl.JidCreate;
|
||||||
import org.jxmpp.stringprep.XmppStringprepException;
|
import org.jxmpp.stringprep.XmppStringprepException;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
import org.signal.libsignal.protocol.InvalidKeyIdException;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.NoSessionException;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.state.IdentityKeyStore;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.IdentityKeyStore;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyStore;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.PreKeyStore;
|
||||||
import org.whispersystems.libsignal.state.SessionStore;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SessionStore;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
import org.signal.libsignal.protocol.state.SignedPreKeyStore;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that adapts libsignal-protocol-java's Store classes to the OmemoStore class.
|
* Class that adapts libsignal-protocol-java's Store classes to the OmemoStore class.
|
||||||
|
@ -184,6 +186,11 @@ public class SignalOmemoStoreConnector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SessionRecord> loadExistingSessions(List<SignalProtocolAddress> addresses) throws NoSessionException {
|
||||||
|
throw new RuntimeException("Not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> getSubDeviceSessions(String s) {
|
public List<Integer> getSubDeviceSessions(String s) {
|
||||||
BareJid jid;
|
BareJid jid;
|
||||||
|
|
|
@ -32,9 +32,9 @@ import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
||||||
import org.jivesoftware.smackx.omemo.signal.SignalOmemoKeyUtil;
|
import org.jivesoftware.smackx.omemo.signal.SignalOmemoKeyUtil;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test SignalOmemoKeyUtil methods.
|
* Test SignalOmemoKeyUtil methods.
|
||||||
|
|
|
@ -28,13 +28,13 @@ import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
|
||||||
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* smack-omemo-signal implementation of {@link OmemoKeyUtilTest}.
|
* smack-omemo-signal implementation of {@link OmemoKeyUtilTest}.
|
||||||
|
|
|
@ -35,15 +35,15 @@ import org.junit.rules.TemporaryFolder;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.jxmpp.stringprep.XmppStringprepException;
|
import org.jxmpp.stringprep.XmppStringprepException;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.SessionCipher;
|
import org.signal.libsignal.protocol.SessionCipher;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
import org.whispersystems.libsignal.state.PreKeyBundle;
|
import org.signal.libsignal.protocol.state.PreKeyBundle;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* smack-omemo-signal implementation of {@link OmemoStoreTest}.
|
* smack-omemo-signal implementation of {@link OmemoStoreTest}.
|
||||||
|
|
Loading…
Reference in a new issue