public Pair <RootKey, ChainKey> createChain(ECPublicKey theirRatchetKey, ECKeyPair ourRatchetKey)
        {
            byte[]             sharedSecret       = Curve.calculateAgreement(theirRatchetKey, ourRatchetKey.getPrivateKey());
            byte[]             derivedSecretBytes = kdf.deriveSecrets(sharedSecret, key, Encoding.UTF8.GetBytes("WhisperRatchet"), DerivedRootSecrets.SIZE);
            DerivedRootSecrets derivedSecrets     = new DerivedRootSecrets(derivedSecretBytes);

            RootKey  newRootKey  = new RootKey(kdf, derivedSecrets.getRootKey());
            ChainKey newChainKey = new ChainKey(kdf, derivedSecrets.getChainKey(), 0);

            return(new Pair <RootKey, ChainKey>(newRootKey, newChainKey));
        }
Exemple #2
0
 internal DerivedKeys(RootKey rootKey, ChainKey chainKey)
 {
     this.rootKey  = rootKey;
     this.chainKey = chainKey;
 }