public static byte[] DESDecrypt(byte[] data, byte[] cryptKey = null, byte[] cryptIV = null) { System.Security.Cryptography.DESCryptoServiceProvider dESCryptoServiceProvider = EncryptHelper.CreateDESCrypto(); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); System.Security.Cryptography.CryptoStream cryptoStream = new System.Security.Cryptography.CryptoStream(memoryStream, dESCryptoServiceProvider.CreateDecryptor(cryptKey, cryptIV), System.Security.Cryptography.CryptoStreamMode.Write); cryptoStream.Write(data, 0, data.Length); cryptoStream.FlushFinalBlock(); return(memoryStream.ToArray()); }
public static string DESDecrypt(string value, Encoding encoding, byte[] cryptKey, byte[] cryptIV) { byte[] data = System.Convert.FromBase64String(value); byte[] bytes = EncryptHelper.DESDecrypt(data, cryptKey, cryptIV); return(encoding.GetString(bytes)); }
public static string DESDecrypt(string value, Encoding encoding) { return(EncryptHelper.DESDecrypt(value, encoding, EncryptHelper.cryptKey, EncryptHelper.cryptIV)); }
public static string DESDecrypt(string value) { return(EncryptHelper.DESDecrypt(value, Encoding.Default)); }
public static string DESEncrypt(string value, Encoding encoding, byte[] cryptKey = null, byte[] cryptIV = null) { byte[] bytes = encoding.GetBytes(value); byte[] inArray = EncryptHelper.DESEncrypt(bytes, cryptKey, cryptIV); return(System.Convert.ToBase64String(inArray)); }
public static string Base64Decode(string value) { return(EncryptHelper.Base64Decode(value, System.Text.Encoding.Default)); }