예제 #1
0
        public static void Equivalence_TlsPrf(int labelSize)
        {
            using (ECDiffieHellmanCng ecdh = NewDefaultECDHCng())
                using (ECDiffieHellmanPublicKey publicKey = ecdh.PublicKey)
                {
                    byte[] label = new byte[labelSize];
                    byte[] seed  = new byte[64];

                    byte[] newWay = ecdh.DeriveKeyTls(publicKey, label, seed);

                    ecdh.Label = label;
                    ecdh.Seed  = seed;
                    ecdh.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Tls;

                    byte[] oldWay = ecdh.DeriveKeyMaterial(publicKey);

                    Assert.Equal(newWay, oldWay);
                }
        }