Example #1
0
 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());
 }
Example #2
0
 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));
 }
Example #3
0
 public static string DESDecrypt(string value, Encoding encoding)
 {
     return(EncryptHelper.DESDecrypt(value, encoding, EncryptHelper.cryptKey, EncryptHelper.cryptIV));
 }
Example #4
0
 public static string DESDecrypt(string value)
 {
     return(EncryptHelper.DESDecrypt(value, Encoding.Default));
 }
Example #5
0
 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));
 }
Example #6
0
 public static string Base64Decode(string value)
 {
     return(EncryptHelper.Base64Decode(value, System.Text.Encoding.Default));
 }