Exemplo n.º 1
0
        public void TestMethod3()
        {
            var rsa       = new RSAEncryption();
            var targetStr = rsa.EncryptWithPriKey("12345", privateKey);

            Assert.IsNotNull(targetStr);
            var targetStr2 = rsa.DecryptWithPubKey(targetStr, publicKey);

            Assert.AreEqual("12345", targetStr2);
        }
Exemplo n.º 2
0
        public static string RSADecryptWithPubKey(this string str, string publicKey, Encoding encoding = null)
        {
            var rsa = new RSAEncryption();

            return(rsa.DecryptWithPubKey(str, publicKey, encoding));
        }