[ConditionalFact("ECDsa224Available")] // Issue #4337 public static void KeySizeProp() { using (ECDsaOpenSsl e = new ECDsaOpenSsl()) { e.KeySize = 384; Assert.Equal(384, e.KeySize); e.Exercise(); e.KeySize = 224; Assert.Equal(224, e.KeySize); e.Exercise(); } }
public static void DefaultCtor() { using (ECDsaOpenSsl e = new ECDsaOpenSsl()) { int keySize = e.KeySize; Assert.Equal(521, keySize); e.Exercise(); } }
public static void Ctor384() { int expectedKeySize = 384; using (ECDsaOpenSsl e = new ECDsaOpenSsl(expectedKeySize)) { int keySize = e.KeySize; Assert.Equal(expectedKeySize, keySize); e.Exercise(); } }
public void KeySizePropWithExercise() { using (ECDsaOpenSsl e = new ECDsaOpenSsl()) { e.KeySize = 384; Assert.Equal(384, e.KeySize); e.Exercise(); ECParameters p384 = e.ExportParameters(false); Assert.Equal(ECCurve.ECCurveType.Named, p384.Curve.CurveType); e.KeySize = 521; Assert.Equal(521, e.KeySize); e.Exercise(); ECParameters p521 = e.ExportParameters(false); Assert.Equal(ECCurve.ECCurveType.Named, p521.Curve.CurveType); // ensure the key was regenerated Assert.NotEqual(p384.Curve.Oid.Value, p521.Curve.Oid.Value); } }
public static void Ctor521() { int expectedKeySize = 521; using (ECDsaOpenSsl e = new ECDsaOpenSsl(expectedKeySize)) { int keySize = e.KeySize; Assert.Equal(expectedKeySize, keySize); e.Exercise(); } }
public void CtorHandle224() { IntPtr ecKey = Interop.Crypto.EcKeyCreateByOid(ECDSA_P224_OID_VALUE); Assert.NotEqual(IntPtr.Zero, ecKey); int success = Interop.Crypto.EcKeyGenerateKey(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { int keySize = e.KeySize; Assert.Equal(224, keySize); e.Exercise(); } Interop.Crypto.EcKeyDestroy(ecKey); }
public static void CtorHandle224() { IntPtr ecKey = Interop.Crypto.EcKeyCreateByCurveName(NID_secp224r1); Assert.NotEqual(IntPtr.Zero, ecKey); int success = Interop.Crypto.EcKeyGenerateKey(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { int keySize = e.KeySize; Assert.Equal(224, keySize); e.Exercise(); } Interop.Crypto.EcKeyDestroy(ecKey); }
public static void CtorHandle224() { IntPtr ecKey = EC_KEY_new_by_curve_name(NID_secp224r1); Assert.NotEqual(IntPtr.Zero, ecKey); int success = EC_KEY_generate_key(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { int keySize = e.KeySize; Assert.Equal(224, keySize); e.Exercise(); } EC_KEY_free(ecKey); }
public static void CtorHandle384() { IntPtr ecKey = EC_KEY_new_by_curve_name(NID_secp384r1); Assert.NotEqual(IntPtr.Zero, ecKey); int success = EC_KEY_generate_key(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { int keySize = e.KeySize; Assert.Equal(384, keySize); e.Exercise(); } EC_KEY_free(ecKey); }
public void CtorHandle384() { IntPtr ecKey = Interop.Crypto.EcKeyCreateByOid(ECDSA_P384_OID_VALUE); Assert.NotEqual(IntPtr.Zero, ecKey); int success = Interop.Crypto.EcKeyGenerateKey(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { int keySize = e.KeySize; Assert.Equal(384, keySize); e.Exercise(); } Interop.Crypto.EcKeyDestroy(ecKey); }
[ConditionalFact("ECDsa224Available")] // Issue #4337 public static void CtorHandle224() { IntPtr ecKey = Interop.Crypto.EcKeyCreateByCurveName(NID_secp224r1); Assert.NotEqual(IntPtr.Zero, ecKey); int success = Interop.Crypto.EcKeyGenerateKey(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { int keySize = e.KeySize; Assert.Equal(224, keySize); e.Exercise(); } Interop.Crypto.EcKeyDestroy(ecKey); }
public static void CtorHandleDuplicate() { IntPtr ecKey = EC_KEY_new_by_curve_name(NID_secp521r1); Assert.NotEqual(IntPtr.Zero, ecKey); int success = EC_KEY_generate_key(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { // Make sure ECDsaOpenSsl did his own ref-count bump. EC_KEY_free(ecKey); int keySize = e.KeySize; Assert.Equal(521, keySize); e.Exercise(); } }
public void CtorHandleDuplicate() { IntPtr ecKey = Interop.Crypto.EcKeyCreateByOid(ECDSA_P521_OID_VALUE); Assert.NotEqual(IntPtr.Zero, ecKey); int success = Interop.Crypto.EcKeyGenerateKey(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { // Make sure ECDsaOpenSsl did its own ref-count bump. Interop.Crypto.EcKeyDestroy(ecKey); int keySize = e.KeySize; Assert.Equal(521, keySize); e.Exercise(); } }
public static void CtorHandleDuplicate() { IntPtr ecKey = Interop.Crypto.EcKeyCreateByCurveName(NID_secp521r1); Assert.NotEqual(IntPtr.Zero, ecKey); int success = Interop.Crypto.EcKeyGenerateKey(ecKey); Assert.NotEqual(0, success); using (ECDsaOpenSsl e = new ECDsaOpenSsl(ecKey)) { // Make sure ECDsaOpenSsl did his own ref-count bump. Interop.Crypto.EcKeyDestroy(ecKey); int keySize = e.KeySize; Assert.Equal(521, keySize); e.Exercise(); } }
public static void KeySizeProp() { using (ECDsaOpenSsl e = new ECDsaOpenSsl()) { e.KeySize = 384; Assert.Equal(384, e.KeySize); e.Exercise(); e.KeySize = 224; Assert.Equal(224, e.KeySize); e.Exercise(); } }