mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Add comment style checkstyle rule requiring a space
This commit is contained in:
parent
52bd680bb5
commit
9e11b68144
44 changed files with 161 additions and 165 deletions
|
@ -317,7 +317,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
preKeys.put(Integer.parseInt(f.getName()), p);
|
||||
|
||||
} catch (IOException e) {
|
||||
//Do nothing
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
return preKeys;
|
||||
|
@ -355,7 +355,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
signedPreKeys.put(Integer.parseInt(f.getName()), p);
|
||||
|
||||
} catch (IOException e) {
|
||||
//Do nothing
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
return signedPreKeys;
|
||||
|
@ -414,7 +414,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
sessions.put(id, s);
|
||||
|
||||
} catch (IOException e) {
|
||||
//Do nothing
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
return sessions;
|
||||
|
@ -469,7 +469,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
return null;
|
||||
}
|
||||
|
||||
//active
|
||||
// active
|
||||
File activeDevicesPath = hierarchy.getContactsActiveDevicesPath(omemoManager, contact);
|
||||
try {
|
||||
cachedDeviceList.getActiveDevices().addAll(readIntegers(activeDevicesPath));
|
||||
|
@ -477,12 +477,12 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
// Don't worry...
|
||||
}
|
||||
|
||||
//inactive
|
||||
// inactive
|
||||
File inactiveDevicesPath = hierarchy.getContactsInactiveDevicesPath(omemoManager, contact);
|
||||
try {
|
||||
cachedDeviceList.getInactiveDevices().addAll(readIntegers(inactiveDevicesPath));
|
||||
} catch (IOException e) {
|
||||
//It's ok :)
|
||||
// It's ok :)
|
||||
}
|
||||
|
||||
return cachedDeviceList;
|
||||
|
@ -631,7 +631,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
throw new IOException("Could not write bytes to null-path.");
|
||||
}
|
||||
|
||||
//Create file
|
||||
// Create file
|
||||
FileHierarchy.createFile(target);
|
||||
|
||||
IOException io = null;
|
||||
|
@ -730,7 +730,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
integers.add(in.readInt());
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
//Reached end of the list.
|
||||
// Reached end of the list.
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -178,7 +178,7 @@ public final class OmemoManager extends Manager {
|
|||
if (connection.getUser() != null) {
|
||||
user = connection.getUser().asBareJid();
|
||||
} else {
|
||||
//This might be dangerous
|
||||
// This might be dangerous
|
||||
try {
|
||||
user = JidCreate.bareFrom(((AbstractXMPPConnection) connection).getConfiguration().getUsername());
|
||||
} catch (XmppStringprepException e) {
|
||||
|
@ -406,7 +406,7 @@ public final class OmemoManager extends Manager {
|
|||
* @throws CorruptedOmemoKeyException
|
||||
*/
|
||||
public void regenerate() throws SmackException, InterruptedException, XMPPException.XMPPErrorException, CorruptedOmemoKeyException {
|
||||
//create a new identity and publish new keys to the server
|
||||
// create a new identity and publish new keys to the server
|
||||
getOmemoService().regenerate(this, null);
|
||||
getOmemoService().publishDeviceIdIfNeeded(this,false);
|
||||
getOmemoService().publishBundle(this);
|
||||
|
@ -622,9 +622,9 @@ public final class OmemoManager extends Manager {
|
|||
* @throws PubSubException.NotALeafNodeException if the bundle node on the server is a CollectionNode
|
||||
*/
|
||||
public void rotateSignedPreKey() throws CorruptedOmemoKeyException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException, PubSubException.NotALeafNodeException {
|
||||
//generate key
|
||||
// generate key
|
||||
getOmemoService().getOmemoStoreBackend().changeSignedPreKey(this);
|
||||
//publish
|
||||
// publish
|
||||
getOmemoService().publishDeviceIdIfNeeded(this, false);
|
||||
getOmemoService().publishBundle(this);
|
||||
}
|
||||
|
@ -788,31 +788,31 @@ public final class OmemoManager extends Manager {
|
|||
continue;
|
||||
}
|
||||
|
||||
//Device List <list>
|
||||
// Device List <list>
|
||||
OmemoDeviceListVAxolotlElement omemoDeviceListElement = (OmemoDeviceListVAxolotlElement) payloadItem.getPayload();
|
||||
int ourDeviceId = getDeviceId();
|
||||
getOmemoService().getOmemoStoreBackend().mergeCachedDeviceList(OmemoManager.this, from, omemoDeviceListElement);
|
||||
|
||||
if (from == null) {
|
||||
//Unknown sender, no more work to do.
|
||||
//TODO: This DOES happen for some reason. Figure out when...
|
||||
// Unknown sender, no more work to do.
|
||||
// TODO: This DOES happen for some reason. Figure out when...
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!from.equals(getOwnJid())) {
|
||||
//Not our deviceList, so nothing more to do
|
||||
// Not our deviceList, so nothing more to do
|
||||
continue;
|
||||
}
|
||||
|
||||
if (omemoDeviceListElement.getDeviceIds().contains(ourDeviceId)) {
|
||||
//We are on the list. Nothing more to do
|
||||
// We are on the list. Nothing more to do
|
||||
continue;
|
||||
}
|
||||
|
||||
//Our deviceList and we are not on it! We don't want to miss all the action!!!
|
||||
// Our deviceList and we are not on it! We don't want to miss all the action!!!
|
||||
LOGGER.log(Level.INFO, "Our deviceId was not on the list!");
|
||||
Set<Integer> deviceListIds = omemoDeviceListElement.copyDeviceIds();
|
||||
//enroll at the deviceList
|
||||
// enroll at the deviceList
|
||||
deviceListIds.add(ourDeviceId);
|
||||
final OmemoDeviceListVAxolotlElement newOmemoDeviceListElement = new OmemoDeviceListVAxolotlElement(deviceListIds);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
throws NoSuchPaddingException, InvalidKeyException, UnsupportedEncodingException, IllegalBlockSizeException,
|
||||
BadPaddingException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException {
|
||||
|
||||
//Check availability of algorithms and encodings needed for crypto
|
||||
// Check availability of algorithms and encodings needed for crypto
|
||||
checkAvailableAlgorithms();
|
||||
}
|
||||
|
||||
|
@ -214,12 +214,12 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
boolean mustPublishId = false;
|
||||
if (getOmemoStoreBackend().isFreshInstallation(omemoManager)) {
|
||||
LOGGER.log(Level.INFO, "No key material found. Looks like we have a fresh installation.");
|
||||
//Create new key material and publish it to the server
|
||||
// Create new key material and publish it to the server
|
||||
regenerate(omemoManager, omemoManager.getDeviceId());
|
||||
mustPublishId = true;
|
||||
}
|
||||
|
||||
//Get fresh device list from server
|
||||
// Get fresh device list from server
|
||||
mustPublishId |= refreshOwnDeviceList(omemoManager);
|
||||
|
||||
publishDeviceIdIfNeeded(omemoManager, false, mustPublishId);
|
||||
|
@ -244,7 +244,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
protected static void checkAvailableAlgorithms() throws NoSuchPaddingException, UnsupportedEncodingException,
|
||||
InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException,
|
||||
NoSuchProviderException, InvalidKeyException {
|
||||
//Test crypto functions
|
||||
// Test crypto functions
|
||||
new OmemoMessageBuilder<>(null, null, "");
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* (should never ever happen *crosses fingers*)
|
||||
*/
|
||||
void regenerate(OmemoManager omemoManager, Integer nDeviceId) throws CorruptedOmemoKeyException {
|
||||
//Generate unique ID that is not already taken
|
||||
// Generate unique ID that is not already taken
|
||||
while (nDeviceId == null || !getOmemoStoreBackend().isAvailableDeviceId(omemoManager, nDeviceId)) {
|
||||
nDeviceId = OmemoManager.randomDeviceId();
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
getOmemoStoreBackend().setDateOfLastSignedPreKeyRenewal(omemoManager);
|
||||
}
|
||||
|
||||
//publish
|
||||
// publish
|
||||
PubSubManager.getInstance(omemoManager.getConnection(), omemoManager.getOwnJid())
|
||||
.tryToPublishAndPossibleAutoCreate(OmemoConstants.PEP_NODE_BUNDLE_FROM_DEVICE_ID(omemoManager.getDeviceId()),
|
||||
new PayloadItem<>(getOmemoStoreBackend().packOmemoBundle(omemoManager)));
|
||||
|
@ -369,12 +369,12 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
boolean removeStaleDevicesIfNeeded(OmemoManager omemoManager, Set<Integer> deviceListIds) {
|
||||
boolean publish = false;
|
||||
int ownDeviceId = omemoManager.getDeviceId();
|
||||
//Clear devices that we didn't receive a message from for a while
|
||||
// Clear devices that we didn't receive a message from for a while
|
||||
Iterator<Integer> it = deviceListIds.iterator();
|
||||
while (OmemoConfiguration.getDeleteStaleDevices() && it.hasNext()) {
|
||||
int id = it.next();
|
||||
if (id == ownDeviceId) {
|
||||
//Skip own id
|
||||
// Skip own id
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -601,11 +601,11 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
for (int id : devices.getActiveDevices()) {
|
||||
OmemoDevice device = new OmemoDevice(jid, id);
|
||||
if (getOmemoStoreBackend().containsRawSession(omemoManager, device)) {
|
||||
//We have a session already.
|
||||
// We have a session already.
|
||||
continue;
|
||||
}
|
||||
|
||||
//Build missing session
|
||||
// Build missing session
|
||||
try {
|
||||
buildSessionFromOmemoBundle(omemoManager, device, false);
|
||||
} catch (CannotEstablishOmemoSessionException e) {
|
||||
|
@ -648,7 +648,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
return;
|
||||
}
|
||||
|
||||
//Do not build sessions with devices we already know...
|
||||
// Do not build sessions with devices we already know...
|
||||
if (!fresh && getOmemoStoreBackend().containsRawSession(omemoManager, device)) {
|
||||
getOmemoStoreBackend().getOmemoSessionOf(omemoManager, device); //Make sure its loaded though
|
||||
return;
|
||||
|
@ -663,10 +663,10 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
|
||||
HashMap<Integer, T_Bundle> bundles = getOmemoStoreBackend().keyUtil().BUNDLE.bundles(bundle, device);
|
||||
|
||||
//Select random Bundle
|
||||
// Select random Bundle
|
||||
int randomIndex = new Random().nextInt(bundles.size());
|
||||
T_Bundle randomPreKeyBundle = new ArrayList<>(bundles.values()).get(randomIndex);
|
||||
//Build raw session
|
||||
// Build raw session
|
||||
processBundle(omemoManager, randomPreKeyBundle, device);
|
||||
}
|
||||
|
||||
|
@ -701,9 +701,9 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
CryptoFailedException, XMPPException.XMPPErrorException, CorruptedOmemoKeyException {
|
||||
|
||||
ArrayList<OmemoVAxolotlElement.OmemoHeader.Key> messageRecipientKeys = message.getHeader().getKeys();
|
||||
//Do we have a key with our ID in the message?
|
||||
// Do we have a key with our ID in the message?
|
||||
for (OmemoVAxolotlElement.OmemoHeader.Key k : messageRecipientKeys) {
|
||||
//Only decrypt with our deviceID
|
||||
// Only decrypt with our deviceID
|
||||
if (k.getId() != omemoManager.getDeviceId()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
throws CryptoFailedException, UndecidedOmemoIdentityException, NoSuchAlgorithmException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, CannotEstablishOmemoSessionException {
|
||||
|
||||
CannotEstablishOmemoSessionException sessionException = null;
|
||||
//Them - The contact wants to read the message on all their devices.
|
||||
// Them - The contact wants to read the message on all their devices.
|
||||
HashMap<BareJid, ArrayList<OmemoDevice>> receivers = new HashMap<>();
|
||||
for (BareJid recipient : recipients) {
|
||||
try {
|
||||
|
@ -820,7 +820,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
}
|
||||
|
||||
//Us - We want to read the message on all of our devices
|
||||
// Us - We want to read the message on all of our devices
|
||||
CachedDeviceList ourDevices = getOmemoStoreBackend().loadCachedDeviceList(omemoManager, omemoManager.getOwnJid());
|
||||
if (ourDevices == null) {
|
||||
ourDevices = new CachedDeviceList();
|
||||
|
@ -830,7 +830,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
for (int id : ourDevices.getActiveDevices()) {
|
||||
OmemoDevice ourDevice = new OmemoDevice(omemoManager.getOwnJid(), id);
|
||||
if (id == omemoManager.getDeviceId()) {
|
||||
//Don't build session with our exact device.
|
||||
// Don't build session with our exact device.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -957,11 +957,11 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
try {
|
||||
builder.addRecipient(c);
|
||||
} catch (CorruptedOmemoKeyException e) {
|
||||
//TODO: How to react?
|
||||
// TODO: How to react?
|
||||
LOGGER.log(Level.SEVERE, "encryptOmemoMessage failed to establish a session with device "
|
||||
+ c + ": " + e.getMessage());
|
||||
} catch (UndecidedOmemoIdentityException e) {
|
||||
//Collect all undecided devices
|
||||
// Collect all undecided devices
|
||||
if (undecided == null) {
|
||||
undecided = e;
|
||||
} else {
|
||||
|
@ -1132,7 +1132,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
List<ClearTextMessage> result = new ArrayList<>();
|
||||
for (Forwarded f : mamQueryResult.forwardedMessages) {
|
||||
if (OmemoManager.stanzaContainsOmemoElement(f.getForwardedStanza())) {
|
||||
//Decrypt OMEMO messages
|
||||
// Decrypt OMEMO messages
|
||||
try {
|
||||
result.add(processLocalMessage(omemoManager, f.getForwardedStanza().getFrom().asBareJid(), (Message) f.getForwardedStanza()));
|
||||
} catch (NoRawSessionException | CorruptedOmemoKeyException | CryptoFailedException e) {
|
||||
|
@ -1140,7 +1140,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
+ f.getForwardedStanza().getFrom() + " due to corrupted session/key: " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
//Wrap cleartext messages
|
||||
// Wrap cleartext messages
|
||||
Message m = (Message) f.getForwardedStanza();
|
||||
result.add(new ClearTextMessage(m.getBody(), m,
|
||||
new OmemoMessageInformation(null, null, OmemoMessageInformation.CARBON.NONE, false)));
|
||||
|
@ -1210,7 +1210,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
MultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(omemoManager.getConnection());
|
||||
OmemoDevice senderDevice = getSender(omemoManager, stanza);
|
||||
try {
|
||||
//Is it a MUC message...
|
||||
// Is it a MUC message...
|
||||
if (isMucMessage(omemoManager, stanza)) {
|
||||
|
||||
MultiUserChat muc = mucm.getMultiUserChat(stanza.getFrom().asEntityBareJidIfPossible());
|
||||
|
@ -1231,7 +1231,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
}
|
||||
}
|
||||
//... or a normal chat message...
|
||||
// ... or a normal chat message...
|
||||
else {
|
||||
if (omemoMessage.isMessageElement()) {
|
||||
|
||||
|
@ -1304,7 +1304,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
|
||||
try {
|
||||
//Is it a MUC message...
|
||||
// Is it a MUC message...
|
||||
if (isMucMessage(omemoManager, carbonCopy)) {
|
||||
|
||||
MultiUserChat muc = mucm.getMultiUserChat(carbonCopy.getFrom().asEntityBareJidIfPossible());
|
||||
|
@ -1325,7 +1325,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
}
|
||||
}
|
||||
//... or a normal chat message...
|
||||
// ... or a normal chat message...
|
||||
else {
|
||||
if (omemoMessage.isMessageElement()) {
|
||||
|
||||
|
|
|
@ -84,14 +84,14 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
boolean isAvailableDeviceId(OmemoManager omemoManager, int id) {
|
||||
LOGGER.log(Level.INFO, "Check if id " + id + " is available...");
|
||||
|
||||
//Lookup local cached device list
|
||||
// Lookup local cached device list
|
||||
BareJid ownJid = omemoManager.getOwnJid();
|
||||
CachedDeviceList cachedDeviceList = loadCachedDeviceList(omemoManager, ownJid);
|
||||
|
||||
if (cachedDeviceList == null) {
|
||||
cachedDeviceList = new CachedDeviceList();
|
||||
}
|
||||
//Does the list already contain that id?
|
||||
// Does the list already contain that id?
|
||||
return !cachedDeviceList.contains(id);
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
*/
|
||||
void initializeOmemoSessions(OmemoManager omemoManager) {
|
||||
|
||||
//Get HashMap of our omemoSessions
|
||||
// Get HashMap of our omemoSessions
|
||||
HashMap<OmemoDevice, OmemoSession<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>>
|
||||
sessions = omemoSessions.get(omemoManager);
|
||||
if (sessions == null) {
|
||||
|
@ -228,12 +228,12 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
omemoSessions.put(omemoManager, sessions);
|
||||
}
|
||||
|
||||
//Sessions with our own devices
|
||||
// Sessions with our own devices
|
||||
HashMap<Integer, T_Sess> ourRawSessions = loadAllRawSessionsOf(omemoManager, omemoManager.getOwnJid());
|
||||
ourRawSessions.remove(omemoManager.getDeviceId()); //Just to make sure we have no session with ourselves...
|
||||
sessions.putAll(createOmemoSessionsFromRawSessions(omemoManager, omemoManager.getOwnJid(), ourRawSessions));
|
||||
|
||||
//Sessions with contacts
|
||||
// Sessions with contacts
|
||||
for (RosterEntry rosterEntry : Roster.getInstanceFor(omemoManager.getConnection()).getEntries()) {
|
||||
HashMap<Integer, T_Sess> contactDevices = loadAllRawSessionsOf(omemoManager, rosterEntry.getJid().asBareJid());
|
||||
sessions.putAll(createOmemoSessionsFromRawSessions(omemoManager, rosterEntry.getJid().asBareJid(), contactDevices));
|
||||
|
@ -284,7 +284,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
|
||||
OmemoSession<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||
session = sessions.get(device);
|
||||
//No OmemoSession found
|
||||
// No OmemoSession found
|
||||
if (session == null) {
|
||||
T_IdKey identityKey = null;
|
||||
try {
|
||||
|
|
|
@ -129,9 +129,9 @@ public abstract class OmemoSession<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
|
||||
if (unpackedKey.length == 32) {
|
||||
authTag = new byte[16];
|
||||
//copy key part into messageKey
|
||||
// copy key part into messageKey
|
||||
System.arraycopy(unpackedKey, 0, messageKey, 0, 16);
|
||||
//copy tag part into authTag
|
||||
// copy tag part into authTag
|
||||
System.arraycopy(unpackedKey, 16, authTag, 0,16);
|
||||
} else if (element.isKeyTransportElement() && unpackedKey.length == 16) {
|
||||
messageKey = unpackedKey;
|
||||
|
|
|
@ -22,14 +22,14 @@ package org.jivesoftware.smackx.omemo.util;
|
|||
*/
|
||||
public final class OmemoConstants {
|
||||
|
||||
//Constants
|
||||
// Constants
|
||||
/**
|
||||
* Omemo related namespace.
|
||||
*/
|
||||
public static final String OMEMO_NAMESPACE_V_AXOLOTL = "eu.siacs.conversations.axolotl";
|
||||
public static final String OMEMO = "OMEMO";
|
||||
|
||||
//PubSub Node names
|
||||
// PubSub Node names
|
||||
public static final String PEP_NODE_DEVICE_LIST = OMEMO_NAMESPACE_V_AXOLOTL + ".devicelist";
|
||||
public static final String PEP_NODE_DEVICE_LIST_NOTIFY = PEP_NODE_DEVICE_LIST + "+notify";
|
||||
public static final String PEP_NODE_BUNDLES = OMEMO_NAMESPACE_V_AXOLOTL + ".bundles";
|
||||
|
|
|
@ -144,7 +144,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
return;
|
||||
}
|
||||
|
||||
//Encrypt message body
|
||||
// Encrypt message body
|
||||
SecretKey secretKey = new SecretKeySpec(messageKey, KEYTYPE);
|
||||
IvParameterSpec ivSpec = new IvParameterSpec(initializationVector);
|
||||
Cipher cipher = Cipher.getInstance(CIPHERMODE, PROVIDER);
|
||||
|
@ -194,12 +194,12 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
|
||||
if (session != null) {
|
||||
if (!ignoreTrust && !omemoStore.isDecidedOmemoIdentity(omemoManager, device, session.getIdentityKey())) {
|
||||
//Warn user of undecided device
|
||||
// Warn user of undecided device
|
||||
throw new UndecidedOmemoIdentityException(device);
|
||||
}
|
||||
|
||||
if (!ignoreTrust && omemoStore.isTrustedOmemoIdentity(omemoManager, device, session.getIdentityKey())) {
|
||||
//Encrypt key and save to header
|
||||
// Encrypt key and save to header
|
||||
CiphertextTuple encryptedKey = session.encryptMessageKey(messageKey);
|
||||
keys.add(new OmemoVAxolotlElement.OmemoHeader.Key(encryptedKey.getCiphertext(), device.getDeviceId(), encryptedKey.isPreKeyMessage()));
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class OmemoConfigurationTest {
|
|||
OmemoConfiguration.setMaxNumberOfStoredSignedPreKeys(0);
|
||||
TestCase.fail("OmemoConfiguration.setMaxNumberOfStoredSignedPreKeys should not accept values <= 0");
|
||||
} catch (IllegalArgumentException e) {
|
||||
//Expected
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue