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); }
public void ImportParameters(ECDiffieHellmanPublicKey otherPartyPublicKey) { var opp = otherPartyPublicKey.ToByteArray(); q = ECPoint.FromBlob(opp); }