예제 #1
0
        public void AsymmetricCrypto_KeyEquality()
        {
            string key;

            key = AsymmetricCrypto.CreatePrivateKey(CryptoAlgorithm.RSA, 1024);
            Assert.IsTrue(AsymmetricCrypto.KeyEquality(CryptoAlgorithm.RSA, key, key));
            Assert.IsTrue(AsymmetricCrypto.KeyEquality(CryptoAlgorithm.RSA, key, " \t\r\n" + key + " \t\r\n"));
            Assert.IsTrue(AsymmetricCrypto.KeyEquality(CryptoAlgorithm.RSA, key, key.Replace("<Modulus>", " \t<Modulus>\r\n")));
            Assert.IsFalse(AsymmetricCrypto.KeyEquality(CryptoAlgorithm.RSA, key, AsymmetricCrypto.CreatePrivateKey(CryptoAlgorithm.RSA, 1024)));
            Assert.IsFalse(AsymmetricCrypto.KeyEquality(CryptoAlgorithm.RSA, key, AsymmetricCrypto.GetPublicKey(CryptoAlgorithm.RSA, key)));
        }