예제 #1
0
        public void TestReadPrivateKeyFile_ShouldSupportPkcs8Der2048bits()
        {
            // GIVEN
            const string keyPath = "./_Resources/Keys/Pkcs8/test_key_pkcs8-2048.der";

            // WHEN
            var rsa = RsaKeyUtils.ReadPrivateKeyFile(keyPath);

            // THEN
            Assert.AreNotEqual("RSACryptoServiceProvider", rsa.GetType().Name);
            Assert.AreEqual(2048, rsa.KeySize);
        }
예제 #2
0
        public void TestReadPrivateKeyFile_ShouldSupportPkcs8Pem512bits()
        {
            // GIVEN
            const string keyPath = "./_Resources/Keys/Pkcs8/test_key_pkcs8-512.pem";

            // WHEN
            var rsa = RsaKeyUtils.ReadPrivateKeyFile(keyPath);

            // THEN
            Assert.AreNotEqual("RSACryptoServiceProvider", rsa.GetType().Name); // We expect a RSACng (Windows) or a RSAOpenSsl (Linux, macOS)
            Assert.AreEqual(512, rsa.KeySize);
        }