public override byte[] DeriveKeyMaterial(ECDiffieHellmanPublicKey otherPartyPublicKey)
        {
            var d = privateKey.D;

            // read the other side's public key.
            var     opp = otherPartyPublicKey.ToByteArray();
            ECPoint Qs  = ECPoint.FromBlob(opp);

            // multiply their public key with our private d to get the shared secret.
            var p = Qs * d;
            var z = p.X.ToByteArray().Reverse().ToArray();

            return(z);
        }
Example #2
0
        public void ImportParameters(ECDiffieHellmanPublicKey otherPartyPublicKey)
        {
            var opp = otherPartyPublicKey.ToByteArray();

            q = ECPoint.FromBlob(opp);
        }