mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-27 14:32:06 +01:00
Temp commit
This commit is contained in:
parent
9a779ff8aa
commit
85171ee71b
14 changed files with 195 additions and 196 deletions
|
@ -62,13 +62,13 @@ public class SignalOmemoRatchet
|
|||
private static final Logger LOGGER = Logger.getLogger(OmemoRatchet.class.getName());
|
||||
private final SignalOmemoStoreConnector storeConnector;
|
||||
|
||||
SignalOmemoRatchet(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
SignalOmemoRatchet(OmemoManager omemoManager,
|
||||
OmemoStore<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord,
|
||||
SessionRecord, SignalProtocolAddress, ECPublicKey, PreKeyBundle,
|
||||
SessionCipher> store)
|
||||
{
|
||||
super(managerGuard, store);
|
||||
this.storeConnector = new SignalOmemoStoreConnector(managerGuard, store);
|
||||
super(omemoManager, store);
|
||||
this.storeConnector = new SignalOmemoStoreConnector(omemoManager, store);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,8 +157,7 @@ public class SignalOmemoRatchet
|
|||
}
|
||||
|
||||
private SessionCipher getCipher(OmemoDevice device) {
|
||||
SignalOmemoKeyUtil keyUtil = (SignalOmemoKeyUtil) store.keyUtil();
|
||||
SignalProtocolAddress address = keyUtil.omemoDeviceAsAddress(device);
|
||||
return new SessionCipher(storeConnector, storeConnector, storeConnector, storeConnector, address);
|
||||
return new SessionCipher(storeConnector, storeConnector, storeConnector, storeConnector,
|
||||
SignalOmemoStoreConnector.asAddress(device));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public final class SignalOmemoService
|
|||
|
||||
@Override
|
||||
protected SignalOmemoRatchet instantiateOmemoRatchet(
|
||||
OmemoManager.KnownBareJidGuard manager,
|
||||
OmemoManager manager,
|
||||
OmemoStore<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord, SessionRecord,
|
||||
SignalProtocolAddress, ECPublicKey, PreKeyBundle, SessionCipher> store)
|
||||
{
|
||||
|
@ -111,14 +111,14 @@ public final class SignalOmemoService
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void processBundle(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
protected void processBundle(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
PreKeyBundle preKeyBundle,
|
||||
OmemoDevice device)
|
||||
throws CorruptedOmemoKeyException
|
||||
{
|
||||
SignalOmemoStoreConnector connector = new SignalOmemoStoreConnector(managerGuard, getOmemoStoreBackend());
|
||||
SignalOmemoStoreConnector connector = new SignalOmemoStoreConnector(managerGuard.get(), getOmemoStoreBackend());
|
||||
SessionBuilder builder = new SessionBuilder(connector, connector, connector, connector,
|
||||
getOmemoStoreBackend().keyUtil().omemoDeviceAsAddress(device));
|
||||
SignalOmemoStoreConnector.asAddress(device));
|
||||
try {
|
||||
builder.process(preKeyBundle);
|
||||
LOGGER.log(Level.FINE, "Session built with " + device);
|
||||
|
|
|
@ -59,20 +59,20 @@ public class SignalOmemoStoreConnector
|
|||
|
||||
private static final Logger LOGGER = Logger.getLogger(SignalOmemoStoreConnector.class.getName());
|
||||
|
||||
private final OmemoManager.KnownBareJidGuard managerGuard;
|
||||
private final OmemoManager omemoManager;
|
||||
private final OmemoStore<IdentityKeyPair, IdentityKey, PreKeyRecord, SignedPreKeyRecord, SessionRecord,
|
||||
SignalProtocolAddress, ECPublicKey, PreKeyBundle, SessionCipher>
|
||||
omemoStore;
|
||||
|
||||
public SignalOmemoStoreConnector(OmemoManager.KnownBareJidGuard managerGuard, OmemoStore<IdentityKeyPair,
|
||||
public SignalOmemoStoreConnector(OmemoManager omemoManager, OmemoStore<IdentityKeyPair,
|
||||
IdentityKey, PreKeyRecord, SignedPreKeyRecord, SessionRecord, SignalProtocolAddress, ECPublicKey,
|
||||
PreKeyBundle, SessionCipher> store) {
|
||||
this.managerGuard = managerGuard;
|
||||
this.omemoManager = omemoManager;
|
||||
this.omemoStore = store;
|
||||
}
|
||||
|
||||
OmemoDevice getOurDevice() {
|
||||
return managerGuard.get().getOwnDevice();
|
||||
return omemoManager.getOwnDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +98,7 @@ public class SignalOmemoStoreConnector
|
|||
public boolean saveIdentity(SignalProtocolAddress signalProtocolAddress, IdentityKey identityKey) {
|
||||
OmemoDevice device;
|
||||
try {
|
||||
device = omemoStore.keyUtil().addressAsOmemoDevice(signalProtocolAddress);
|
||||
device = asOmemoDevice(signalProtocolAddress);
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class SignalOmemoStoreConnector
|
|||
public SessionRecord loadSession(SignalProtocolAddress signalProtocolAddress) {
|
||||
OmemoDevice device;
|
||||
try {
|
||||
device = omemoStore.keyUtil().addressAsOmemoDevice(signalProtocolAddress);
|
||||
device = asOmemoDevice(signalProtocolAddress);
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class SignalOmemoStoreConnector
|
|||
public void storeSession(SignalProtocolAddress signalProtocolAddress, SessionRecord sessionRecord) {
|
||||
OmemoDevice device;
|
||||
try {
|
||||
device = omemoStore.keyUtil().addressAsOmemoDevice(signalProtocolAddress);
|
||||
device = asOmemoDevice(signalProtocolAddress);
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public class SignalOmemoStoreConnector
|
|||
public boolean containsSession(SignalProtocolAddress signalProtocolAddress) {
|
||||
OmemoDevice device;
|
||||
try {
|
||||
device = omemoStore.keyUtil().addressAsOmemoDevice(signalProtocolAddress);
|
||||
device = asOmemoDevice(signalProtocolAddress);
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class SignalOmemoStoreConnector
|
|||
public void deleteSession(SignalProtocolAddress signalProtocolAddress) {
|
||||
OmemoDevice device;
|
||||
try {
|
||||
device = omemoStore.keyUtil().addressAsOmemoDevice(signalProtocolAddress);
|
||||
device = asOmemoDevice(signalProtocolAddress);
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -259,4 +259,12 @@ public class SignalOmemoStoreConnector
|
|||
public void removeSignedPreKey(int i) {
|
||||
omemoStore.removeOmemoSignedPreKey(getOurDevice(), i);
|
||||
}
|
||||
|
||||
public static OmemoDevice asOmemoDevice(SignalProtocolAddress address) throws XmppStringprepException {
|
||||
return new OmemoDevice(JidCreate.bareFrom(address.getName()), address.getDeviceId());
|
||||
}
|
||||
|
||||
public static SignalProtocolAddress asAddress(OmemoDevice device) {
|
||||
return new SignalProtocolAddress(device.getJid().toString(), device.getDeviceId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,15 +28,11 @@ import static junit.framework.TestCase.fail;
|
|||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||
import org.jivesoftware.smackx.omemo.signal.SignalOmemoKeyUtil;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||
|
||||
/**
|
||||
|
@ -97,26 +93,4 @@ public class LegacySignalOmemoKeyUtilTest extends SmackTestSuite {
|
|||
assertTrue("Length of fingerprint must be 64.",
|
||||
keyUtil.getFingerprintOfIdentityKey(ik).length() == 64);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addressToDeviceTest() {
|
||||
SignalProtocolAddress address = new SignalProtocolAddress("test@server.tld",1337);
|
||||
try {
|
||||
OmemoDevice device = keyUtil.addressAsOmemoDevice(address);
|
||||
assertEquals(device, new OmemoDevice(JidCreate.bareFrom("test@server.tld"), 1337));
|
||||
} catch (XmppStringprepException e) {
|
||||
fail("Could not convert address to device: " + e + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deviceToAddressTest() {
|
||||
try {
|
||||
OmemoDevice device = new OmemoDevice(JidCreate.bareFrom("test@server.tld"), 1337);
|
||||
SignalProtocolAddress address = keyUtil.omemoDeviceAsAddress(device);
|
||||
assertEquals(address, new SignalProtocolAddress("test@server.tld", 1337));
|
||||
} catch (XmppStringprepException e) {
|
||||
fail("Could not convert device to address: " + e + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.WeakHashMap;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.AbstractConnectionListener;
|
||||
import org.jivesoftware.smack.Manager;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.StanzaListener;
|
||||
|
@ -96,11 +97,12 @@ import org.jxmpp.jid.EntityFullJid;
|
|||
public final class OmemoManager extends Manager {
|
||||
private static final Logger LOGGER = Logger.getLogger(OmemoManager.class.getName());
|
||||
|
||||
private static final Integer UNKNOWN_DEVICE_ID = -1;
|
||||
private final Object LOCK = new Object();
|
||||
|
||||
private static final WeakHashMap<XMPPConnection, TreeMap<Integer,OmemoManager>> INSTANCES = new WeakHashMap<>();
|
||||
private final OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> service;
|
||||
|
||||
private final Object LOCK = new Object();
|
||||
|
||||
private final HashSet<OmemoMessageListener> omemoMessageListeners = new HashSet<>();
|
||||
private final HashSet<OmemoMucMessageListener> omemoMucMessageListeners = new HashSet<>();
|
||||
|
||||
|
@ -110,20 +112,30 @@ public final class OmemoManager extends Manager {
|
|||
private Integer deviceId;
|
||||
|
||||
/**
|
||||
* Private constructor to prevent multiple instances on a single connection (which probably would be bad!).
|
||||
* Private constructor.
|
||||
*
|
||||
* @param connection connection
|
||||
* @param deviceId deviceId
|
||||
*/
|
||||
private OmemoManager(XMPPConnection connection, Integer deviceId) {
|
||||
super(connection);
|
||||
|
||||
service = OmemoService.getInstance();
|
||||
|
||||
if (deviceId != null && deviceId <= 0) {
|
||||
throw new IllegalArgumentException("DeviceId MUST be greater than 0.");
|
||||
this.deviceId = deviceId;
|
||||
|
||||
if (connection.isAuthenticated()) {
|
||||
initBareJidAndDeviceId(this);
|
||||
} else {
|
||||
connection.addConnectionListener(new AbstractConnectionListener() {
|
||||
@Override
|
||||
public void authenticated(XMPPConnection connection, boolean resumed) {
|
||||
initBareJidAndDeviceId(OmemoManager.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.deviceId = deviceId;
|
||||
service.registerManager(this);
|
||||
|
||||
// StanzaListeners
|
||||
startStanzaListeners();
|
||||
|
@ -137,20 +149,20 @@ public final class OmemoManager extends Manager {
|
|||
* If there was an OmemoManager for the connection and id before, return it. Otherwise create a new OmemoManager
|
||||
* instance and return it.
|
||||
* @param connection XmppConnection.
|
||||
* @param deviceId can be null, to generate a random deviceId. DeviceIds MUST NOT be less than 1.
|
||||
* @param deviceId MUST NOT be null and MUST be greater than 0.
|
||||
* @return
|
||||
*/
|
||||
public synchronized static OmemoManager getInstanceFor(XMPPConnection connection, Integer deviceId) {
|
||||
if (deviceId == null || deviceId < 1) {
|
||||
throw new IllegalArgumentException("DeviceId MUST NOT be null and MUST be greater than 0.");
|
||||
}
|
||||
|
||||
TreeMap<Integer,OmemoManager> managersOfConnection = INSTANCES.get(connection);
|
||||
if (managersOfConnection == null) {
|
||||
managersOfConnection = new TreeMap<>();
|
||||
INSTANCES.put(connection, managersOfConnection);
|
||||
}
|
||||
|
||||
if (deviceId == null || deviceId < 1) {
|
||||
deviceId = randomDeviceId();
|
||||
}
|
||||
|
||||
OmemoManager manager = managersOfConnection.get(deviceId);
|
||||
if (manager == null) {
|
||||
manager = new OmemoManager(connection, deviceId);
|
||||
|
@ -177,8 +189,8 @@ public final class OmemoManager extends Manager {
|
|||
OmemoManager manager;
|
||||
if (managers.size() == 0) {
|
||||
|
||||
manager = new OmemoManager(connection, null);
|
||||
managers.put(null, manager);
|
||||
manager = new OmemoManager(connection, UNKNOWN_DEVICE_ID);
|
||||
managers.put(UNKNOWN_DEVICE_ID, manager);
|
||||
|
||||
} else {
|
||||
manager = managers.get(managers.firstKey());
|
||||
|
@ -218,14 +230,7 @@ public final class OmemoManager extends Manager {
|
|||
throw new SmackException.NotLoggedInException();
|
||||
}
|
||||
|
||||
// Set jid and deviceId
|
||||
this.ownJid = connection().getUser().asBareJid();
|
||||
if (deviceId == null) {
|
||||
SortedSet<Integer> localDeviceIds = getOmemoService().getOmemoStoreBackend().localDeviceIdsOf(ownJid);
|
||||
setDeviceId(localDeviceIds.size() > 0 ? localDeviceIds.first() : randomDeviceId());
|
||||
}
|
||||
|
||||
getOmemoService().initialize(new KnownBareJidGuard(this));
|
||||
getOmemoService().publish(new LoggedInOmemoManager(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,7 +275,7 @@ public final class OmemoManager extends Manager {
|
|||
SmackException.NoResponseException, SmackException.NotLoggedInException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
KnownBareJidGuard guard = new KnownBareJidGuard(this);
|
||||
LoggedInOmemoManager guard = new LoggedInOmemoManager(this);
|
||||
Message plaintext = new Message();
|
||||
plaintext.setBody(message);
|
||||
OmemoVAxolotlElement encrypted = getOmemoService().processSendingMessage(guard, to, plaintext);
|
||||
|
@ -302,7 +307,7 @@ public final class OmemoManager extends Manager {
|
|||
Message m = new Message();
|
||||
m.setBody(message);
|
||||
OmemoVAxolotlElement encrypted = getOmemoService().processSendingMessage(
|
||||
new KnownBareJidGuard(this), recipients, m);
|
||||
new LoggedInOmemoManager(this), recipients, m);
|
||||
return finishMessage(encrypted);
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +369,7 @@ public final class OmemoManager extends Manager {
|
|||
Message m = new Message();
|
||||
m.setBody(message);
|
||||
OmemoVAxolotlElement encrypted = getOmemoService()
|
||||
.encryptOmemoMessage(new KnownBareJidGuard(this), exception.getSuccesses(), m);
|
||||
.encryptOmemoMessage(new LoggedInOmemoManager(this), exception.getSuccesses(), m);
|
||||
return finishMessage(encrypted);
|
||||
}
|
||||
}
|
||||
|
@ -389,7 +394,7 @@ public final class OmemoManager extends Manager {
|
|||
SmackException.NotLoggedInException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
return getOmemoService().processLocalMessage(new KnownBareJidGuard(this), sender, omemoMessage);
|
||||
return getOmemoService().processLocalMessage(new LoggedInOmemoManager(this), sender, omemoMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +415,7 @@ public final class OmemoManager extends Manager {
|
|||
{
|
||||
synchronized (LOCK) {
|
||||
List<ClearTextMessage> l = new ArrayList<>();
|
||||
l.addAll(getOmemoService().decryptMamQueryResult(new KnownBareJidGuard(this), mamQueryResult));
|
||||
l.addAll(getOmemoService().decryptMamQueryResult(new LoggedInOmemoManager(this), mamQueryResult));
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
@ -489,7 +494,7 @@ public final class OmemoManager extends Manager {
|
|||
throws SmackException, InterruptedException, XMPPException.XMPPErrorException, CorruptedOmemoKeyException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
KnownBareJidGuard managerGuard = new KnownBareJidGuard(this);
|
||||
LoggedInOmemoManager managerGuard = new LoggedInOmemoManager(this);
|
||||
getOmemoService().publishDeviceIdIfNeeded(managerGuard, true);
|
||||
getOmemoService().publishBundle(managerGuard);
|
||||
}
|
||||
|
@ -506,7 +511,7 @@ public final class OmemoManager extends Manager {
|
|||
throws SmackException, InterruptedException, XMPPException.XMPPErrorException, CorruptedOmemoKeyException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
KnownBareJidGuard managerGuard = new KnownBareJidGuard(this);
|
||||
LoggedInOmemoManager managerGuard = new LoggedInOmemoManager(this);
|
||||
// create a new identity and publish new keys to the server
|
||||
getOmemoService().regenerate(managerGuard);
|
||||
getOmemoService().publishDeviceIdIfNeeded(managerGuard, false);
|
||||
|
@ -530,7 +535,7 @@ public final class OmemoManager extends Manager {
|
|||
{
|
||||
synchronized (LOCK) {
|
||||
getOmemoService().sendOmemoRatchetUpdateMessage(
|
||||
new KnownBareJidGuard(this), recipient, false);
|
||||
new LoggedInOmemoManager(this), recipient, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,7 +558,7 @@ public final class OmemoManager extends Manager {
|
|||
{
|
||||
synchronized (LOCK) {
|
||||
return getOmemoService().prepareOmemoKeyTransportElement(
|
||||
new KnownBareJidGuard(this), aesKey, iv, to);
|
||||
new LoggedInOmemoManager(this), aesKey, iv, to);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -605,7 +610,7 @@ public final class OmemoManager extends Manager {
|
|||
SmackException.NotLoggedInException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
KnownBareJidGuard managerGuard = new KnownBareJidGuard(this);
|
||||
LoggedInOmemoManager managerGuard = new LoggedInOmemoManager(this);
|
||||
|
||||
getOmemoService().refreshDeviceList(managerGuard, contact);
|
||||
return !getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(), contact)
|
||||
|
@ -681,7 +686,7 @@ public final class OmemoManager extends Manager {
|
|||
return getOwnFingerprint();
|
||||
}
|
||||
|
||||
return getOmemoService().getOmemoStoreBackend().getFingerprint(new KnownBareJidGuard(this), device);
|
||||
return getOmemoService().getOmemoStoreBackend().getFingerprint(new LoggedInOmemoManager(this), device);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,7 +751,7 @@ public final class OmemoManager extends Manager {
|
|||
SmackException.NoResponseException, SmackException.NotLoggedInException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
getOmemoService().buildMissingOmemoSessions(new KnownBareJidGuard(this), contact);
|
||||
getOmemoService().buildMissingOmemoSessions(new LoggedInOmemoManager(this), contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -763,7 +768,7 @@ public final class OmemoManager extends Manager {
|
|||
SmackException.NotLoggedInException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
getOmemoService().refreshDeviceList(new KnownBareJidGuard(this), contact);
|
||||
getOmemoService().refreshDeviceList(new LoggedInOmemoManager(this), contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,7 +790,7 @@ public final class OmemoManager extends Manager {
|
|||
PubSubException.NotALeafNodeException, SmackException.NotLoggedInException
|
||||
{
|
||||
synchronized (LOCK) {
|
||||
KnownBareJidGuard managerGuard = new KnownBareJidGuard(this);
|
||||
LoggedInOmemoManager managerGuard = new LoggedInOmemoManager(this);
|
||||
// generate key
|
||||
getOmemoService().getOmemoStoreBackend().changeSignedPreKey(getOwnDevice());
|
||||
// publish
|
||||
|
@ -940,12 +945,16 @@ public final class OmemoManager extends Manager {
|
|||
*/
|
||||
public void startStanzaListeners() {
|
||||
PEPManager pepManager = PEPManager.getInstanceFor(connection());
|
||||
pepManager.removePEPListener(deviceListUpdateListener);
|
||||
pepManager.addPEPListener(deviceListUpdateListener);
|
||||
connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener);
|
||||
connection().addAsyncStanzaListener(internalOmemoMessageStanzaListener, omemoMessageStanzaFilter);
|
||||
CarbonManager carbonManager = CarbonManager.getInstanceFor(connection());
|
||||
|
||||
// Remove listeners to avoid them getting added twice
|
||||
connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener);
|
||||
carbonManager.removeCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
|
||||
pepManager.removePEPListener(deviceListUpdateListener);
|
||||
|
||||
// Add listeners
|
||||
pepManager.addPEPListener(deviceListUpdateListener);
|
||||
connection().addAsyncStanzaListener(internalOmemoMessageStanzaListener, omemoMessageStanzaFilter);
|
||||
carbonManager.addCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
|
||||
}
|
||||
|
||||
|
@ -979,14 +988,14 @@ public final class OmemoManager extends Manager {
|
|||
|
||||
private final PEPListener deviceListUpdateListener = new PEPListener() {
|
||||
|
||||
KnownBareJidGuard managerGuard = null;
|
||||
LoggedInOmemoManager managerGuard = null;
|
||||
|
||||
@Override
|
||||
public void eventReceived(EntityBareJid from, EventElement event, Message message) {
|
||||
|
||||
if (managerGuard == null) {
|
||||
try {
|
||||
managerGuard = new KnownBareJidGuard(OmemoManager.this);
|
||||
managerGuard = new LoggedInOmemoManager(OmemoManager.this);
|
||||
} catch (SmackException.NotLoggedInException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -1066,7 +1075,7 @@ public final class OmemoManager extends Manager {
|
|||
public void processStanza(Stanza packet) throws SmackException.NotConnectedException, InterruptedException {
|
||||
try {
|
||||
getOmemoService().onOmemoMessageStanzaReceived(packet,
|
||||
new KnownBareJidGuard(OmemoManager.this));
|
||||
new LoggedInOmemoManager(OmemoManager.this));
|
||||
} catch (SmackException.NotLoggedInException e) {
|
||||
LOGGER.warning("Received OMEMO stanza while being offline: " + e);
|
||||
}
|
||||
|
@ -1081,7 +1090,7 @@ public final class OmemoManager extends Manager {
|
|||
if (omemoMessageStanzaFilter.accept(carbonCopy)) {
|
||||
try {
|
||||
getOmemoService().onOmemoCarbonCopyReceived(direction, carbonCopy, wrappingMessage,
|
||||
new KnownBareJidGuard(OmemoManager.this));
|
||||
new LoggedInOmemoManager(OmemoManager.this));
|
||||
} catch (SmackException.NotLoggedInException e) {
|
||||
LOGGER.warning("Received OMEMO carbon copy while being offline: " + e);
|
||||
}
|
||||
|
@ -1099,11 +1108,11 @@ public final class OmemoManager extends Manager {
|
|||
}
|
||||
};
|
||||
|
||||
public static class KnownBareJidGuard {
|
||||
public static class LoggedInOmemoManager {
|
||||
|
||||
private final OmemoManager manager;
|
||||
|
||||
public KnownBareJidGuard(OmemoManager manager)
|
||||
public LoggedInOmemoManager(OmemoManager manager)
|
||||
throws SmackException.NotLoggedInException {
|
||||
|
||||
if (manager == null) {
|
||||
|
@ -1132,4 +1141,23 @@ public final class OmemoManager extends Manager {
|
|||
|
||||
void initializationFailed(Exception cause);
|
||||
}
|
||||
|
||||
private static void initBareJidAndDeviceId(OmemoManager manager) {
|
||||
if (!manager.getConnection().isAuthenticated()) {
|
||||
throw new IllegalStateException("Connection MUST be authenticated.");
|
||||
}
|
||||
|
||||
if (manager.ownJid == null) {
|
||||
manager.ownJid = manager.getConnection().getUser().asBareJid();
|
||||
}
|
||||
|
||||
if (UNKNOWN_DEVICE_ID.equals(manager.deviceId)) {
|
||||
SortedSet<Integer> storedDeviceIds = manager.getOmemoService().getOmemoStoreBackend().localDeviceIdsOf(manager.ownJid);
|
||||
if (storedDeviceIds.size() > 0) {
|
||||
manager.setDeviceId(storedDeviceIds.first());
|
||||
} else {
|
||||
manager.setDeviceId(randomDeviceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,12 +39,12 @@ import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
|||
public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> {
|
||||
private static final Logger LOGGER = Logger.getLogger(OmemoRatchet.class.getName());
|
||||
|
||||
protected final OmemoManager.KnownBareJidGuard managerGuard;
|
||||
protected final OmemoManager omemoManager;
|
||||
protected final OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> store;
|
||||
|
||||
public OmemoRatchet(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
public OmemoRatchet(OmemoManager omemoManager,
|
||||
OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> store) {
|
||||
this.managerGuard = managerGuard;
|
||||
this.omemoManager = omemoManager;
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
|
@ -58,13 +58,13 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* Try to decrypt the transported message key using the double ratchet session.
|
||||
*
|
||||
* @param element omemoElement
|
||||
* @return tuple of cipher generated from the unpacked message key and the authtag
|
||||
* @return tuple of cipher generated from the unpacked message key and the auth-tag
|
||||
* @throws CryptoFailedException if decryption using the double ratchet fails
|
||||
* @throws NoRawSessionException if we have no session, but the element was NOT a PreKeyMessage
|
||||
*/
|
||||
public CipherAndAuthTag retrieveMessageKeyAndAuthTag(OmemoDevice sender, OmemoElement element) throws CryptoFailedException,
|
||||
CipherAndAuthTag retrieveMessageKeyAndAuthTag(OmemoDevice sender, OmemoElement element) throws CryptoFailedException,
|
||||
NoRawSessionException {
|
||||
int keyId = managerGuard.get().getDeviceId();
|
||||
int keyId = omemoManager.getDeviceId();
|
||||
byte[] unpackedKey = null;
|
||||
List<CryptoFailedException> decryptExceptions = new ArrayList<>();
|
||||
List<OmemoElement.OmemoHeader.Key> keys = element.getHeader().getKeys();
|
||||
|
@ -124,7 +124,7 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @return Message containing the decrypted payload in its body.
|
||||
* @throws CryptoFailedException
|
||||
*/
|
||||
public static Message decryptMessageElement(OmemoElement element, CipherAndAuthTag cipherAndAuthTag) throws CryptoFailedException {
|
||||
static Message decryptMessageElement(OmemoElement element, CipherAndAuthTag cipherAndAuthTag) throws CryptoFailedException {
|
||||
if (!element.isMessageElement()) {
|
||||
throw new IllegalArgumentException("decryptMessageElement cannot decrypt OmemoElement which is no MessageElement!");
|
||||
}
|
||||
|
@ -133,10 +133,8 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
throw new CryptoFailedException("AuthenticationTag is null or has wrong length: "
|
||||
+ (cipherAndAuthTag.getAuthTag() == null ? "null" : cipherAndAuthTag.getAuthTag().length));
|
||||
}
|
||||
byte[] encryptedBody = new byte[element.getPayload().length + 16];
|
||||
byte[] payload = element.getPayload();
|
||||
System.arraycopy(payload, 0, encryptedBody, 0, payload.length);
|
||||
System.arraycopy(cipherAndAuthTag.getAuthTag(), 0, encryptedBody, payload.length, 16);
|
||||
|
||||
byte[] encryptedBody = payloadAndAuthTag(element, cipherAndAuthTag.getAuthTag());
|
||||
|
||||
try {
|
||||
String plaintext = new String(cipherAndAuthTag.getCipher().doFinal(encryptedBody), StringUtils.UTF8);
|
||||
|
@ -149,4 +147,16 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static byte[] payloadAndAuthTag(OmemoElement element, byte[] authTag) {
|
||||
if (!element.isMessageElement()) {
|
||||
throw new IllegalArgumentException("OmemoElement has no payload.");
|
||||
}
|
||||
|
||||
byte[] payload = new byte[element.getPayload().length + authTag.length];
|
||||
System.arraycopy(element.getPayload(), 0, payload, 0, element.getPayload().length);
|
||||
System.arraycopy(authTag, 0, payload, payload.length, authTag.length);
|
||||
return payload;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
private static OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> INSTANCE;
|
||||
|
||||
protected OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> omemoStore;
|
||||
protected final HashMap<OmemoManager, OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>> sessionManagers = new HashMap<>();
|
||||
protected final HashMap<OmemoManager, OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>> omemoRatchets = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Return the singleton instance of this class. When no instance is set, throw an IllegalStateException instead.
|
||||
|
@ -206,6 +206,10 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
checkAvailableAlgorithms();
|
||||
}
|
||||
|
||||
void registerManager(OmemoManager manager) {
|
||||
omemoRatchets.put(manager, instantiateOmemoRatchet(manager, getOmemoStoreBackend()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize OMEMO functionality for OmemoManager omemoManager.
|
||||
*
|
||||
|
@ -218,12 +222,11 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NotLoggedInException
|
||||
* @throws PubSubException.NotALeafNodeException
|
||||
*/
|
||||
void initialize(OmemoManager.KnownBareJidGuard managerGuard)
|
||||
void publish(OmemoManager.LoggedInOmemoManager managerGuard)
|
||||
throws InterruptedException, CorruptedOmemoKeyException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException,
|
||||
PubSubException.NotALeafNodeException
|
||||
{
|
||||
sessionManagers.put(managerGuard.get(), instantiateOmemoRatchet(managerGuard, getOmemoStoreBackend()));
|
||||
// Create new keys if necessary and publish to the server.
|
||||
publishBundle(managerGuard);
|
||||
|
||||
|
@ -260,9 +263,9 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CorruptedOmemoKeyException when freshly generated identityKey is invalid
|
||||
* (should never ever happen *crosses fingers*)
|
||||
*/
|
||||
void regenerate(OmemoManager.KnownBareJidGuard managerGuard)
|
||||
throws CorruptedOmemoKeyException
|
||||
{
|
||||
void regenerate(OmemoManager.LoggedInOmemoManager managerGuard)
|
||||
throws CorruptedOmemoKeyException, InterruptedException, PubSubException.NotALeafNodeException,
|
||||
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
OmemoManager omemoManager = managerGuard.get();
|
||||
OmemoDevice userDevice = omemoManager.getOwnDevice();
|
||||
|
||||
|
@ -275,6 +278,8 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
|
||||
getOmemoStoreBackend().purgeOwnDeviceKeys(userDevice);
|
||||
omemoManager.setDeviceId(nDeviceId);
|
||||
|
||||
publish(managerGuard);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,7 +292,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CorruptedOmemoKeyException
|
||||
* @throws XMPPException.XMPPErrorException
|
||||
*/
|
||||
void publishBundle(OmemoManager.KnownBareJidGuard managerGuard)
|
||||
void publishBundle(OmemoManager.LoggedInOmemoManager managerGuard)
|
||||
throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
|
||||
CorruptedOmemoKeyException, XMPPException.XMPPErrorException
|
||||
{
|
||||
|
@ -325,7 +330,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NotConnectedException
|
||||
* @throws SmackException.NoResponseException
|
||||
*/
|
||||
void publishDeviceIdIfNeeded(OmemoManager.KnownBareJidGuard managerGuard, boolean deleteOtherDevices)
|
||||
void publishDeviceIdIfNeeded(OmemoManager.LoggedInOmemoManager managerGuard, boolean deleteOtherDevices)
|
||||
throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException
|
||||
{
|
||||
|
@ -346,7 +351,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws XMPPException.XMPPErrorException
|
||||
* @throws PubSubException.NotALeafNodeException
|
||||
*/
|
||||
void publishDeviceIdIfNeeded(OmemoManager.KnownBareJidGuard managerGuard, boolean deleteOtherDevices, boolean publish)
|
||||
void publishDeviceIdIfNeeded(OmemoManager.LoggedInOmemoManager managerGuard, boolean deleteOtherDevices, boolean publish)
|
||||
throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
|
||||
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException
|
||||
{
|
||||
|
@ -386,7 +391,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param deviceListIds deviceIds we plan to publish. Stale devices are deleted from that list.
|
||||
* @return
|
||||
*/
|
||||
boolean removeStaleDevicesIfNeeded(OmemoManager.KnownBareJidGuard managerGuard, Set<Integer> deviceListIds) {
|
||||
boolean removeStaleDevicesIfNeeded(OmemoManager.LoggedInOmemoManager managerGuard, Set<Integer> deviceListIds) {
|
||||
OmemoManager omemoManager = managerGuard.get();
|
||||
OmemoDevice userDevice = omemoManager.getOwnDevice();
|
||||
boolean publish = false;
|
||||
|
@ -433,7 +438,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NoResponseException Exception
|
||||
* @throws PubSubException.NotALeafNodeException Exception
|
||||
*/
|
||||
static void publishDeviceIds(OmemoManager.KnownBareJidGuard managerGuard, OmemoDeviceListElement deviceList)
|
||||
static void publishDeviceIds(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDeviceListElement deviceList)
|
||||
throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException,
|
||||
SmackException.NoResponseException, PubSubException.NotALeafNodeException
|
||||
{
|
||||
|
@ -455,7 +460,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NoResponseException
|
||||
* @throws NotAPubSubNodeException
|
||||
*/
|
||||
static LeafNode fetchDeviceListNode(OmemoManager.KnownBareJidGuard managerGuard, BareJid contact)
|
||||
static LeafNode fetchDeviceListNode(OmemoManager.LoggedInOmemoManager managerGuard, BareJid contact)
|
||||
throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException, NotAPubSubNodeException
|
||||
{
|
||||
|
@ -476,7 +481,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws PubSubException.NotALeafNodeException when the device lists node is not a LeafNode
|
||||
* @throws NotAPubSubNodeException
|
||||
*/
|
||||
static OmemoDeviceListElement fetchDeviceList(OmemoManager.KnownBareJidGuard managerGuard, BareJid contact)
|
||||
static OmemoDeviceListElement fetchDeviceList(OmemoManager.LoggedInOmemoManager managerGuard, BareJid contact)
|
||||
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
||||
SmackException.NoResponseException, PubSubException.NotALeafNodeException, NotAPubSubNodeException
|
||||
{
|
||||
|
@ -493,7 +498,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws InterruptedException
|
||||
* @throws SmackException.NoResponseException
|
||||
*/
|
||||
private boolean refreshOwnDeviceList(OmemoManager.KnownBareJidGuard managerGuard)
|
||||
private boolean refreshOwnDeviceList(OmemoManager.LoggedInOmemoManager managerGuard)
|
||||
throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
|
||||
XMPPException.XMPPErrorException
|
||||
{
|
||||
|
@ -536,7 +541,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws InterruptedException
|
||||
* @throws SmackException.NoResponseException
|
||||
*/
|
||||
void refreshDeviceList(OmemoManager.KnownBareJidGuard managerGuard, BareJid contact)
|
||||
void refreshDeviceList(OmemoManager.LoggedInOmemoManager managerGuard, BareJid contact)
|
||||
throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException
|
||||
{
|
||||
OmemoDeviceListElement omemoDeviceListElement;
|
||||
|
@ -565,7 +570,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws PubSubException.NotALeafNodeException when the bundles node is not a LeafNode
|
||||
* @throws NotAPubSubNodeException
|
||||
*/
|
||||
static OmemoBundleVAxolotlElement fetchBundle(OmemoManager.KnownBareJidGuard managerGuard, OmemoDevice contact)
|
||||
static OmemoBundleVAxolotlElement fetchBundle(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contact)
|
||||
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
||||
SmackException.NoResponseException, PubSubException.NotALeafNodeException, NotAPubSubNodeException
|
||||
{
|
||||
|
@ -642,7 +647,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param managerGuard omemoManager
|
||||
* @param jid the BareJid of the contact
|
||||
*/
|
||||
void buildMissingOmemoSessions(OmemoManager.KnownBareJidGuard managerGuard, BareJid jid)
|
||||
void buildMissingOmemoSessions(OmemoManager.LoggedInOmemoManager managerGuard, BareJid jid)
|
||||
throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
|
||||
CannotEstablishOmemoSessionException
|
||||
{
|
||||
|
@ -702,7 +707,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CannotEstablishOmemoSessionException when no session could be established
|
||||
* @throws CorruptedOmemoKeyException when the bundle contained an invalid OMEMO identityKey
|
||||
*/
|
||||
public void buildSessionWithDevice(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
public void buildSessionWithDevice(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice contactsDevice,
|
||||
boolean fresh)
|
||||
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException
|
||||
|
@ -743,7 +748,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param device OmemoDevice
|
||||
* @throws CorruptedOmemoKeyException
|
||||
*/
|
||||
protected abstract void processBundle(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
protected abstract void processBundle(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
T_Bundle bundle,
|
||||
OmemoDevice device)
|
||||
throws CorruptedOmemoKeyException;
|
||||
|
@ -764,7 +769,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws XMPPException.XMPPErrorException
|
||||
* @throws CorruptedOmemoKeyException
|
||||
*/
|
||||
private Message processReceivingMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
private Message processReceivingMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice contactsDevice,
|
||||
OmemoElement message,
|
||||
final OmemoMessageInformation information)
|
||||
|
@ -811,7 +816,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws NoRawSessionException When there is no session to decrypt the message with in the double
|
||||
* ratchet library
|
||||
*/
|
||||
ClearTextMessage processLocalMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
ClearTextMessage processLocalMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
BareJid sender,
|
||||
Message message)
|
||||
throws InterruptedException, SmackException.NoResponseException, SmackException.NotConnectedException,
|
||||
|
@ -842,7 +847,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws UndecidedOmemoIdentityException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
OmemoVAxolotlElement processSendingMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
OmemoVAxolotlElement processSendingMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
BareJid recipient,
|
||||
Message message)
|
||||
throws CryptoFailedException, UndecidedOmemoIdentityException, NoSuchAlgorithmException,
|
||||
|
@ -866,7 +871,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws UndecidedOmemoIdentityException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
OmemoVAxolotlElement processSendingMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
OmemoVAxolotlElement processSendingMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
ArrayList<BareJid> recipients,
|
||||
Message message)
|
||||
throws CryptoFailedException, UndecidedOmemoIdentityException, NoSuchAlgorithmException,
|
||||
|
@ -972,7 +977,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NoResponseException
|
||||
* @throws NoRawSessionException
|
||||
*/
|
||||
private Message decryptOmemoMessageElement(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
private Message decryptOmemoMessageElement(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice from,
|
||||
OmemoElement message,
|
||||
final OmemoMessageInformation information)
|
||||
|
@ -1000,7 +1005,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NotConnectedException
|
||||
* @throws SmackException.NoResponseException
|
||||
*/
|
||||
private CipherAndAuthTag decryptTransportedOmemoKey(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
private CipherAndAuthTag decryptTransportedOmemoKey(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice sender,
|
||||
OmemoElement omemoMessage,
|
||||
OmemoMessageInformation messageInfo)
|
||||
|
@ -1012,7 +1017,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
|
||||
int preKeyCountBefore = getOmemoStoreBackend().loadOmemoPreKeys(userDevice).size();
|
||||
|
||||
CipherAndAuthTag cipherAndAuthTag = sessionManagers.get(managerGuard.get()).retrieveMessageKeyAndAuthTag(sender, omemoMessage);
|
||||
CipherAndAuthTag cipherAndAuthTag = omemoRatchets.get(managerGuard.get()).retrieveMessageKeyAndAuthTag(sender, omemoMessage);
|
||||
|
||||
messageInfo.setSenderDevice(sender);
|
||||
messageInfo.setSenderFingerprint(omemoStore.keyUtil().getFingerprintOfIdentityKey(
|
||||
|
@ -1037,7 +1042,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
*
|
||||
* @return OmemoMessageElement
|
||||
*/
|
||||
OmemoVAxolotlElement encryptOmemoMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
OmemoVAxolotlElement encryptOmemoMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
HashMap<BareJid, ArrayList<OmemoDevice>> recipients,
|
||||
Message message)
|
||||
throws CryptoFailedException, UndecidedOmemoIdentityException
|
||||
|
@ -1045,7 +1050,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
builder;
|
||||
try {
|
||||
builder = new OmemoMessageBuilder<>(managerGuard, getOmemoRatchet(managerGuard), message.getBody());
|
||||
builder = new OmemoMessageBuilder<>(managerGuard, getOmemoRatchet(managerGuard.get()), message.getBody());
|
||||
} catch (UnsupportedEncodingException | BadPaddingException | IllegalBlockSizeException | NoSuchProviderException |
|
||||
NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException | NoSuchAlgorithmException e) {
|
||||
throw new CryptoFailedException(e);
|
||||
|
@ -1090,7 +1095,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CorruptedOmemoKeyException
|
||||
* @throws CannotEstablishOmemoSessionException
|
||||
*/
|
||||
OmemoVAxolotlElement prepareOmemoKeyTransportElement(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
OmemoVAxolotlElement prepareOmemoKeyTransportElement(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice... recipients)
|
||||
throws CryptoFailedException, UndecidedOmemoIdentityException, CorruptedOmemoKeyException,
|
||||
CannotEstablishOmemoSessionException
|
||||
|
@ -1098,7 +1103,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
builder;
|
||||
try {
|
||||
builder = new OmemoMessageBuilder<>(managerGuard, getOmemoRatchet(managerGuard), null);
|
||||
builder = new OmemoMessageBuilder<>(managerGuard, getOmemoRatchet(managerGuard.get()), null);
|
||||
|
||||
} catch (UnsupportedEncodingException | BadPaddingException | IllegalBlockSizeException | NoSuchProviderException |
|
||||
NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException | NoSuchAlgorithmException e) {
|
||||
|
@ -1125,7 +1130,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CorruptedOmemoKeyException
|
||||
* @throws CannotEstablishOmemoSessionException
|
||||
*/
|
||||
OmemoVAxolotlElement prepareOmemoKeyTransportElement(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
OmemoVAxolotlElement prepareOmemoKeyTransportElement(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
byte[] aesKey,
|
||||
byte[] iv,
|
||||
OmemoDevice... recipients)
|
||||
|
@ -1135,7 +1140,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
builder;
|
||||
try {
|
||||
builder = new OmemoMessageBuilder<>(managerGuard, getOmemoRatchet(managerGuard), aesKey, iv);
|
||||
builder = new OmemoMessageBuilder<>(managerGuard, getOmemoRatchet(managerGuard.get()), aesKey, iv);
|
||||
|
||||
} catch (UnsupportedEncodingException | BadPaddingException | IllegalBlockSizeException | NoSuchProviderException |
|
||||
NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException | NoSuchAlgorithmException e) {
|
||||
|
@ -1162,7 +1167,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CryptoFailedException
|
||||
* @throws UndecidedOmemoIdentityException
|
||||
*/
|
||||
protected Message getOmemoRatchetUpdateMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
protected Message getOmemoRatchetUpdateMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice recipient,
|
||||
boolean preKeyMessage)
|
||||
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException, CryptoFailedException,
|
||||
|
@ -1191,7 +1196,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws CryptoFailedException
|
||||
* @throws CannotEstablishOmemoSessionException
|
||||
*/
|
||||
protected void sendOmemoRatchetUpdateMessage(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
protected void sendOmemoRatchetUpdateMessage(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoDevice recipient,
|
||||
boolean preKeyMessage)
|
||||
throws UndecidedOmemoIdentityException, CorruptedOmemoKeyException, CryptoFailedException,
|
||||
|
@ -1220,7 +1225,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @throws SmackException.NotConnectedException
|
||||
* @throws SmackException.NoResponseException
|
||||
*/
|
||||
List<ClearTextMessage> decryptMamQueryResult(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
List<ClearTextMessage> decryptMamQueryResult(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
MamManager.MamQueryResult mamQueryResult)
|
||||
throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException,
|
||||
SmackException.NoResponseException
|
||||
|
@ -1255,7 +1260,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param stanza message
|
||||
* @return BareJid of the sender.
|
||||
*/
|
||||
private static OmemoDevice getSender(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
private static OmemoDevice getSender(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
Stanza stanza) {
|
||||
OmemoElement omemoElement = stanza.getExtension(OmemoElement.ENCRYPTED, OMEMO_NAMESPACE_V_AXOLOTL);
|
||||
Jid sender = stanza.getFrom();
|
||||
|
@ -1276,7 +1281,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param stanza stanza in question
|
||||
* @return true if MUC message, otherwise false.
|
||||
*/
|
||||
private static boolean isMucMessage(OmemoManager.KnownBareJidGuard managerGuard, Stanza stanza) {
|
||||
private static boolean isMucMessage(OmemoManager.LoggedInOmemoManager managerGuard, Stanza stanza) {
|
||||
BareJid sender = stanza.getFrom().asBareJid();
|
||||
MultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(managerGuard.get().getConnection());
|
||||
|
||||
|
@ -1284,7 +1289,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onOmemoMessageStanzaReceived(Stanza stanza, OmemoManager.KnownBareJidGuard managerGuard) {
|
||||
public void onOmemoMessageStanzaReceived(Stanza stanza, OmemoManager.LoggedInOmemoManager managerGuard) {
|
||||
OmemoManager omemoManager = managerGuard.get();
|
||||
Message decrypted;
|
||||
OmemoElement omemoMessage = stanza.getExtension(OmemoElement.ENCRYPTED, OMEMO_NAMESPACE_V_AXOLOTL);
|
||||
|
@ -1360,7 +1365,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
public void onOmemoCarbonCopyReceived(CarbonExtension.Direction direction,
|
||||
Message carbonCopy,
|
||||
Message wrappingMessage,
|
||||
final OmemoManager.KnownBareJidGuard managerGuard)
|
||||
final OmemoManager.LoggedInOmemoManager managerGuard)
|
||||
{
|
||||
OmemoManager omemoManager = managerGuard.get();
|
||||
|
||||
|
@ -1445,17 +1450,17 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
|
||||
protected abstract OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
instantiateOmemoRatchet(OmemoManager.KnownBareJidGuard manager,
|
||||
instantiateOmemoRatchet(OmemoManager manager,
|
||||
OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> store);
|
||||
|
||||
protected OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
getOmemoRatchet(OmemoManager.KnownBareJidGuard guard) {
|
||||
getOmemoRatchet(OmemoManager manager) {
|
||||
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
sessionManager = sessionManagers.get(guard.get());
|
||||
if (sessionManager == null) {
|
||||
sessionManager = instantiateOmemoRatchet(guard, omemoStore);
|
||||
sessionManagers.put(guard.get(), sessionManager);
|
||||
omemoRatchet = omemoRatchets.get(manager);
|
||||
if (omemoRatchet == null) {
|
||||
omemoRatchet = instantiateOmemoRatchet(manager, omemoStore);
|
||||
omemoRatchets.put(manager, omemoRatchet);
|
||||
}
|
||||
return sessionManager;
|
||||
return omemoRatchet;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
keyUtil().signedPreKeyPublicForBundle(currentSignedPreKey),
|
||||
keyUtil().signedPreKeySignatureFromKey(currentSignedPreKey),
|
||||
keyUtil().identityKeyForBundle(keyUtil().identityKeyFromPair(identityKeyPair)),
|
||||
keyUtil().preKeyPublisKeysForBundle(preKeys)
|
||||
keyUtil().preKeyPublicKeysForBundle(preKeys)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
* @throws CannotEstablishOmemoSessionException if we cannot establish a session
|
||||
* @return fingerprint of the identityKey
|
||||
*/
|
||||
public OmemoFingerprint getFingerprint(OmemoManager.KnownBareJidGuard managerGuard, OmemoDevice contactsDevice)
|
||||
public OmemoFingerprint getFingerprint(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice)
|
||||
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException
|
||||
{
|
||||
OmemoManager omemoManager = managerGuard.get();
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
/**
|
||||
* Class that represents a OmemoElement.
|
||||
* Class that represents an OmemoElement.
|
||||
* TODO: Move functionality here.
|
||||
*
|
||||
* @author Paul Schaub
|
||||
|
|
|
@ -25,5 +25,5 @@ import org.jivesoftware.smackx.omemo.OmemoManager;
|
|||
*/
|
||||
public interface OmemoCarbonCopyStanzaReceivedListener {
|
||||
|
||||
void onOmemoCarbonCopyReceived(CarbonExtension.Direction direction, Message carbonCopy, Message wrappingMessage, OmemoManager.KnownBareJidGuard omemoManager);
|
||||
void onOmemoCarbonCopyReceived(CarbonExtension.Direction direction, Message carbonCopy, Message wrappingMessage, OmemoManager.LoggedInOmemoManager omemoManager);
|
||||
}
|
||||
|
|
|
@ -21,5 +21,5 @@ import org.jivesoftware.smackx.omemo.OmemoManager;
|
|||
|
||||
public interface OmemoMessageStanzaReceivedListener {
|
||||
|
||||
void onOmemoMessageStanzaReceived(Stanza stanza, OmemoManager.KnownBareJidGuard omemoManager);
|
||||
void onOmemoMessageStanzaReceived(Stanza stanza, OmemoManager.LoggedInOmemoManager omemoManager);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,20 @@ public class OmemoFingerprint implements CharSequence {
|
|||
return this.toString().trim().equals(otherFingerprint.toString().trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the fingerprint in blocks of 8 characters with spaces between.
|
||||
*
|
||||
* @return Block representation of the fingerprint.
|
||||
*/
|
||||
public String blocksOf8Chars() {
|
||||
StringBuilder pretty = new StringBuilder();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (i != 0) pretty.append(" ");
|
||||
pretty.append(this.fingerprintString.substring(8 * i, 8 * (i + 1)));
|
||||
}
|
||||
return pretty.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return toString().hashCode();
|
||||
|
|
|
@ -28,8 +28,6 @@ import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
|||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
||||
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
|
||||
/**
|
||||
* Class that is used to convert bytes to keys and vice versa.
|
||||
*
|
||||
|
@ -328,7 +326,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param preKeyHashMap HashMap of preKeys
|
||||
* @return HashMap of byte arrays but with the same keyIds as key
|
||||
*/
|
||||
public HashMap<Integer, byte[]> preKeyPublisKeysForBundle(TreeMap<Integer, T_PreKey> preKeyHashMap) {
|
||||
public HashMap<Integer, byte[]> preKeyPublicKeysForBundle(TreeMap<Integer, T_PreKey> preKeyHashMap) {
|
||||
HashMap<Integer, byte[]> out = new HashMap<>();
|
||||
for (Map.Entry<Integer, T_PreKey> e : preKeyHashMap.entrySet()) {
|
||||
out.put(e.getKey(), preKeyForBundle(e.getValue()));
|
||||
|
@ -339,7 +337,7 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
/**
|
||||
* Prepare a public signedPreKey for transport in a bundle.
|
||||
*
|
||||
* @param signedPreKey signedPrekey
|
||||
* @param signedPreKey signedPreKey
|
||||
* @return signedPreKey as byte array
|
||||
*/
|
||||
public abstract byte[] signedPreKeyPublicForBundle(T_SigPreKey signedPreKey);
|
||||
|
@ -376,43 +374,6 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
*/
|
||||
public abstract byte[] rawSessionToBytes(T_Sess session);
|
||||
|
||||
/**
|
||||
* Convert an OmemoDevice to a crypto-lib specific contact format.
|
||||
*
|
||||
* @param contact omemoContact
|
||||
* @return crypto-lib specific contact object
|
||||
*/
|
||||
public abstract T_Addr omemoDeviceAsAddress(OmemoDevice contact);
|
||||
|
||||
/**
|
||||
* Convert a crypto-lib specific contact object into an OmemoDevice.
|
||||
*
|
||||
* @param address contact
|
||||
* @return as OmemoDevice
|
||||
* @throws XmppStringprepException if the address is not a valid BareJid
|
||||
*/
|
||||
public abstract OmemoDevice addressAsOmemoDevice(T_Addr address) throws XmppStringprepException;
|
||||
|
||||
public static String prettyFingerprint(OmemoFingerprint fingerprint) {
|
||||
return prettyFingerprint(fingerprint.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the fingerprint in blocks of 8 characters with spaces between.
|
||||
*
|
||||
* @param ugly fingerprint as continuous string
|
||||
* @return fingerprint with spaces for better readability
|
||||
*/
|
||||
public static String prettyFingerprint(String ugly) {
|
||||
if (ugly == null) return null;
|
||||
String pretty = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (i != 0) pretty += " ";
|
||||
pretty += ugly.substring(8 * i, 8 * (i + 1));
|
||||
}
|
||||
return pretty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add integers modulo MAX_VALUE.
|
||||
*
|
||||
|
|
|
@ -67,7 +67,7 @@ import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
|||
*/
|
||||
public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> {
|
||||
private final OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet;
|
||||
private final OmemoManager.KnownBareJidGuard managerGuard;
|
||||
private final OmemoManager.LoggedInOmemoManager managerGuard;
|
||||
|
||||
private byte[] messageKey = generateKey();
|
||||
private byte[] initializationVector = generateIv();
|
||||
|
@ -91,7 +91,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
* @throws NoSuchProviderException
|
||||
* @throws InvalidAlgorithmParameterException
|
||||
*/
|
||||
public OmemoMessageBuilder(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
public OmemoMessageBuilder(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet,
|
||||
byte[] aesKey, byte[] iv)
|
||||
throws NoSuchPaddingException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException,
|
||||
|
@ -118,7 +118,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
* @throws NoSuchProviderException
|
||||
* @throws InvalidAlgorithmParameterException
|
||||
*/
|
||||
public OmemoMessageBuilder(OmemoManager.KnownBareJidGuard managerGuard,
|
||||
public OmemoMessageBuilder(OmemoManager.LoggedInOmemoManager managerGuard,
|
||||
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> ratchet,
|
||||
String message)
|
||||
throws NoSuchPaddingException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException,
|
||||
|
|
Loading…
Reference in a new issue