public void TestMethod2() { var rsa = new RSAEncryption(); var targetStr = rsa.EncryptWithPubKey("12345", publicKey); Assert.IsNotNull(targetStr); var targetStr2 = rsa.DecryptWithPriKey(targetStr, privateKey); Assert.AreEqual("12345", targetStr2); }
public static string RSADecryptWithPriKey(this string str, string privateKey, Encoding encoding = null) { var rsa = new RSAEncryption(); return(rsa.DecryptWithPriKey(str, privateKey, encoding)); }