/// <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)); } }
/// <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)); } }
/// <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)); } }
/// <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)); } }