示例#1
0
        public static void TestKeyPropertyFromNamedCurve(CurveDef curveDef)
        {
            ECDsaCng e    = new ECDsaCng(curveDef.Curve);
            CngKey   key1 = e.Key;

            VerifyKey(key1);
            e.Exercise();

            CngKey key2 = e.Key;

            Assert.Same(key1, key2);
        }
示例#2
0
        public static void TestCreateKeyFromCngAlgorithmNistP256()
        {
            CngAlgorithm alg = CngAlgorithm.ECDsaP256;

            using (CngKey key = CngKey.Create(alg))
            {
                VerifyKey(key);
                using (ECDsaCng e = new ECDsaCng(key))
                {
                    Assert.Equal(CngAlgorithmGroup.ECDsa, e.Key.AlgorithmGroup);
                    Assert.Equal(CngAlgorithm.ECDsaP256, e.Key.Algorithm);
                    VerifyKey(e.Key);
                    e.Exercise();
                }
            }
        }
示例#3
0
        public static void TestCreateKeyFromCngAlgorithmNistP256()
        {
            CngAlgorithm alg = CngAlgorithm.ECDsaP256;

            using (CngKey key = CngKey.Create(alg))
            {
                VerifyKey(key);
                using (ECDsaCng e = new ECDsaCng(key))
                {
                    Assert.Equal(CngAlgorithmGroup.ECDsa, e.Key.AlgorithmGroup);
                    Assert.Equal(CngAlgorithm.ECDsaP256, e.Key.Algorithm);
                    VerifyKey(e.Key);
                    e.Exercise();
                }
            }
        }
示例#4
0
        public static void TestKeyPropertyFromNamedCurve(CurveDef curveDef)
        {
            ECDsaCng e = new ECDsaCng(curveDef.Curve);
            CngKey key1 = e.Key;
            VerifyKey(key1);
            e.Exercise();

            CngKey key2 = e.Key;
            Assert.Same(key1, key2);
        }