示例#1
0
        public Pair <RootKey, ChainKey> CreateChain(IEcPublicKey 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));
        }
示例#2
0
 internal DerivedKeys(RootKey rootKey, ChainKey chainKey)
 {
     _rootKey  = rootKey;
     _chainKey = chainKey;
 }