Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 internal DerivedKeys(RootKey rootKey, ChainKey chainKey)
 {
     this.rootKey  = rootKey;
     this.chainKey = chainKey;
 }