Esempio n. 1
0
 /// <summary>
 /// 解密
 ///  Key/IV=登录口令/动态口令
 /// </summary>
 /// <param name="cipherText">密文(Base64字符串)</param>
 /// <returns>原文</returns>
 public string Decrypt(string cipherText)
 {
     try
     {
         return(RijndaelCryptoTextProvider.Decrypt(_password, cipherText));
     }
     catch (SystemException) //FormatException & CryptographicException
     {
         throw new UserVerifyException();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 加密
 /// Key/IV=登录口令/动态口令
 /// </summary>
 /// <param name="data">需加密的对象/字符串</param>
 /// <returns>密文(Base64字符串)</returns>
 public string Encrypt(object data)
 {
     return(RijndaelCryptoTextProvider.Encrypt(_password, data is string ds ? ds : Utilities.JsonSerialize(data)));
 }