public static void DefaultCtor() { using (ECDsaOpenSsl e = new ECDsaOpenSsl()) { int keySize = e.KeySize; Assert.Equal(521, keySize); e.Exercise(); } }
public static void Ctor521() { int expectedKeySize = 521; using (ECDsaOpenSsl e = new ECDsaOpenSsl(expectedKeySize)) { int keySize = e.KeySize; Assert.Equal(expectedKeySize, keySize); e.Exercise(); } }
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 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 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(); } }