Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="str"></param>
 /// <param name="key">Key must be 32 character long, add 'AESEncryptionDefaultKey' to config for default key, else pre-default key will be use</param>
 /// <returns></returns>
 public static string Decrypt(string str, string key = "")
 {
     try
     {
         key = string.IsNullOrEmpty(key) ? DefaultKey : key;
         if (key.Length != 32)
         {
             return(string.Empty);
         }
         return(string.IsNullOrEmpty(str) ? null : IosAesEncryptor.DecryptString(str, key));
     }
     catch
     {
         return(null);
     }
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="txt"></param>
 /// <param name="key">Key must be 32 character long, add 'AESEncryptionDefaultKey' to config for default key, else pre-default key will be use</param>
 /// <returns></returns>
 public static string Encrypt(string txt, string key = "")
 {
     try
     {
         key = string.IsNullOrEmpty(key) ? DefaultKey : key;
         if (key.Length != 32)
         {
             return(string.Empty);
         }
         return(string.IsNullOrEmpty(txt) ? string.Empty : IosAesEncryptor.EncryptString(txt, key));
     }
     catch
     {
         return(string.Empty);
     }
 }