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); }
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(); } } }