コード例 #1
0
 public static void DefaultCtor()
 {
     using (ECDsaOpenSsl e = new ECDsaOpenSsl())
     {
         int keySize = e.KeySize;
         Assert.Equal(521, keySize);
         e.Exercise();
     }
 }
コード例 #2
0
 public static void Ctor521()
 {
     int expectedKeySize = 521;
     using (ECDsaOpenSsl e = new ECDsaOpenSsl(expectedKeySize))
     {
         int keySize = e.KeySize;
         Assert.Equal(expectedKeySize, keySize);
         e.Exercise();
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
        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();
            }
        }