Пример #1
0
 public static Task EncryptToFileAsync(this ICipher cipher, string file, string text, bool writeBase64 = false)
 {
     if (writeBase64)
     {
         return(Task.Run(() => File.WriteAllText(file, cipher.EncryptToBase64(text))));
     }
     else
     {
         return(Task.Run(() => File.WriteAllBytes(file, cipher.Encrypt(text))));
     }
 }
Пример #2
0
 /// <summary>
 /// Thread-safe.
 /// </summary>
 public static Task <string> EncryptToBase64Async(this ICipher cipher, string text)
 {
     return(Task.Run(() => cipher.EncryptToBase64(text)));
 }