Esempio n. 1
0
 /// <summary>
 /// 解密
 /// </summary>
 /// <param name="encryptedText">密文</param>
 /// <param name="privateKey">私钥</param>
 /// <param name="decryptedText">明文</param>
 /// <returns></returns>
 public static bool Decrypt(string encryptedText, string privateKey, out string decryptedText)
 {
     try
     {
         decryptedText = RsaHelperForBrowser.Decrypt(privateKey, encryptedText);
         return(true);
     }
     catch (Exception)
     {
         decryptedText = encryptedText;
         return(false);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 加密
 /// </summary>
 /// <param name="plaintText">明文</param>
 /// <param name="publicKey">公钥</param>
 /// <param name="encryptedText">密文</param>
 /// <returns></returns>
 public static bool Encrypt(string plaintText, string publicKey, out string encryptedText)
 {
     try
     {
         encryptedText = RsaHelperForBrowser.Encrypt(publicKey, plaintText);
         return(true);
     }
     catch (Exception)
     {
         encryptedText = plaintText;
         return(false);
     }
 }