예제 #1
0
 /// <summary>
 /// 解密,内部调用SymmCrypto.DecryptToString
 /// </summary>
 /// <param name="cipherText"></param>
 /// <param name="key"></param>
 /// <param name="iv"></param>
 /// <returns></returns>
 public static string DecryptToString(byte[] cipherText, string key, string iv)
 {
     using (var sc = new SymmCrypto(key, iv))
     {
         return(sc.DecryptToString(cipherText));
     }
 }
예제 #2
0
 /// <summary>
 /// 加密,内部调用SymmCrypto.EncryptFromString
 /// </summary>
 /// <param name="plainText"></param>
 /// <param name="key"></param>
 /// <param name="iv"></param>
 /// <returns></returns>
 public static byte[] EncryptFromString(string plainText, string key, string iv)
 {
     using (var sc = new SymmCrypto(key, iv))
     {
         return(sc.EncryptFromString(plainText));
     }
 }
예제 #3
0
 /// <summary>
 /// 解密,内部调用SymmCrypto.Decrypt
 /// </summary>
 /// <param name="cipherText"></param>
 /// <param name="key"></param>
 /// <param name="iv"></param>
 /// <returns></returns>
 public static byte[] Decrypt(byte[] cipherText, byte[] key, byte[] iv)
 {
     using (var sc = new SymmCrypto(key, iv))
     {
         return(sc.Decrypt(cipherText));
     }
 }
예제 #4
0
 /// <summary>
 /// 加密,内部调用SymmCrypto.Encrypt
 /// </summary>
 /// <param name="plainText"></param>
 /// <param name="key"></param>
 /// <param name="iv"></param>
 /// <returns></returns>
 public static byte[] Encrypt(byte[] plainText, byte[] key, byte[] iv)
 {
     using (var sc = new SymmCrypto(key, iv))
     {
         return(sc.Encrypt(plainText));
     }
 }