diff --git a/library/src/org/whispersystems/textsecure/crypto/ratchet/ChainKey.java b/library/src/org/whispersystems/textsecure/crypto/ratchet/ChainKey.java index 0b17a30e74..c3c8b26ffa 100644 --- a/library/src/org/whispersystems/textsecure/crypto/ratchet/ChainKey.java +++ b/library/src/org/whispersystems/textsecure/crypto/ratchet/ChainKey.java @@ -38,7 +38,7 @@ public class ChainKey { public MessageKeys getMessageKeys() { HKDF kdf = new HKDF(); byte[] inputKeyMaterial = getBaseMaterial(MESSAGE_KEY_SEED); - DerivedSecrets keyMaterial = kdf.deriveSecrets(inputKeyMaterial, null); + DerivedSecrets keyMaterial = kdf.deriveSecrets(inputKeyMaterial, "WhisperMessageKeys".getBytes()); return new MessageKeys(keyMaterial.getCipherKey(), keyMaterial.getMacKey(), index); } diff --git a/library/src/org/whispersystems/textsecure/crypto/ratchet/RatchetingSession.java b/library/src/org/whispersystems/textsecure/crypto/ratchet/RatchetingSession.java index 456416bc58..313ccbebe4 100644 --- a/library/src/org/whispersystems/textsecure/crypto/ratchet/RatchetingSession.java +++ b/library/src/org/whispersystems/textsecure/crypto/ratchet/RatchetingSession.java @@ -71,8 +71,8 @@ public class RatchetingSession { sessionRecord.setRootKey(sendingChain.first); } - public static Pair calculate3DHE(ECKeyPair ourEphemeral, ECPublicKey theirEphemeral, - IdentityKeyPair ourIdentity, IdentityKey theirIdentity) + private static Pair calculate3DHE(ECKeyPair ourEphemeral, ECPublicKey theirEphemeral, + IdentityKeyPair ourIdentity, IdentityKey theirIdentity) throws InvalidKeyException { try { diff --git a/library/src/org/whispersystems/textsecure/crypto/ratchet/RootKey.java b/library/src/org/whispersystems/textsecure/crypto/ratchet/RootKey.java index 2d8a4d521d..5ba19bc138 100644 --- a/library/src/org/whispersystems/textsecure/crypto/ratchet/RootKey.java +++ b/library/src/org/whispersystems/textsecure/crypto/ratchet/RootKey.java @@ -30,8 +30,8 @@ public class RootKey { HKDF kdf = new HKDF(); byte[] sharedSecret = Curve.calculateAgreement(theirEphemeral, ourEphemeral.getPrivateKey()); DerivedSecrets keys = kdf.deriveSecrets(sharedSecret, key, "WhisperRatchet".getBytes()); - RootKey newRootKey = new RootKey(keys.getMacKey().getEncoded()); - ChainKey newChainKey = new ChainKey(keys.getCipherKey().getEncoded(), 0); + RootKey newRootKey = new RootKey(keys.getCipherKey().getEncoded()); + ChainKey newChainKey = new ChainKey(keys.getMacKey().getEncoded(), 0); return new Pair(newRootKey, newChainKey); }