コード例 #1
0
ファイル: RootKey.cs プロジェクト: eaba/WhatsApp-API-NET-1
        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));
        }
コード例 #2
0
 internal DerivedKeys(RootKey rootKey, ChainKey chainKey)
 {
     this.rootKey  = rootKey;
     this.chainKey = chainKey;
 }