aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-10-20 14:00:33 +0200
committerChristian Schneppe <christian@pix-art.de>2018-10-20 14:00:33 +0200
commiteed9c5340d287a098e95e1709ac06e45953ab1ae (patch)
tree7c347097dc18f44501d56c149f58da7571399f65
parent24b0846d0851e56f741cef1aa05f6a05d6074fdb (diff)
go back to 16 byte IVs for OMEMO
clients like Dino can’t handle 12 byte IVs
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java2
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlMessage.java24
2 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index 9957aa0e0..cc9d85008 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -550,7 +550,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
} else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": own device " + session.getFingerprint() + " was active " + hours + " hours ago");
}
- }
+ } //TODO print last activation diff
}
}
return devices;
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlMessage.java
index 1f7df2bba..4b4395e60 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlMessage.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlMessage.java
@@ -27,12 +27,12 @@ import rocks.xmpp.addr.Jid;
public class XmppAxolotlMessage {
public static final String CONTAINERTAG = "encrypted";
- public static final String HEADER = "header";
- public static final String SOURCEID = "sid";
- public static final String KEYTAG = "key";
- public static final String REMOTEID = "rid";
- public static final String IVTAG = "iv";
- public static final String PAYLOAD = "payload";
+ private static final String HEADER = "header";
+ private static final String SOURCEID = "sid";
+ private static final String KEYTAG = "key";
+ private static final String REMOTEID = "rid";
+ private static final String IVTAG = "iv";
+ private static final String PAYLOAD = "payload";
private static final String KEYTYPE = "AES";
private static final String CIPHERMODE = "AES/GCM/NoPadding";
@@ -50,7 +50,7 @@ public class XmppAxolotlMessage {
private final String plaintext;
private final String fingerprint;
- public XmppAxolotlPlaintextMessage(String plaintext, String fingerprint) {
+ XmppAxolotlPlaintextMessage(String plaintext, String fingerprint) {
this.plaintext = plaintext;
this.fingerprint = fingerprint;
}
@@ -70,7 +70,7 @@ public class XmppAxolotlMessage {
private final byte[] key;
private final byte[] iv;
- public XmppAxolotlKeyTransportMessage(String fingerprint, byte[] key, byte[] iv) {
+ XmppAxolotlKeyTransportMessage(String fingerprint, byte[] key, byte[] iv) {
this.fingerprint = fingerprint;
this.key = key;
this.iv = iv;
@@ -140,7 +140,7 @@ public class XmppAxolotlMessage {
}
}
- public XmppAxolotlMessage(Jid from, int sourceDeviceId) {
+ XmppAxolotlMessage(Jid from, int sourceDeviceId) {
this.from = from;
this.sourceDeviceId = sourceDeviceId;
this.keys = new SparseArray<>();
@@ -165,7 +165,7 @@ public class XmppAxolotlMessage {
private static byte[] generateIv() {
SecureRandom random = new SecureRandom();
- byte[] iv = new byte[12];
+ byte[] iv = new byte[16];
random.nextBytes(iv);
return iv;
}
@@ -174,7 +174,7 @@ public class XmppAxolotlMessage {
return ciphertext != null;
}
- public void encrypt(String plaintext) throws CryptoFailedException {
+ void encrypt(String plaintext) throws CryptoFailedException {
try {
SecretKey secretKey = new SecretKeySpec(innerKey, KEYTYPE);
IvParameterSpec ivSpec = new IvParameterSpec(iv);
@@ -273,7 +273,7 @@ public class XmppAxolotlMessage {
return session.processReceiving(encryptedKey);
}
- public XmppAxolotlKeyTransportMessage getParameters(XmppAxolotlSession session, Integer sourceDeviceId) throws CryptoFailedException {
+ XmppAxolotlKeyTransportMessage getParameters(XmppAxolotlSession session, Integer sourceDeviceId) throws CryptoFailedException {
return new XmppAxolotlKeyTransportMessage(session.getFingerprint(), unpackKey(session, sourceDeviceId), getIV());
}