Пример #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());
 }
Пример #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));
 }
Пример #3
0
 public static string DESDecrypt(string value, Encoding encoding)
 {
     return(EncryptHelper.DESDecrypt(value, encoding, EncryptHelper.cryptKey, EncryptHelper.cryptIV));
 }
Пример #4
0
 public static string DESDecrypt(string value)
 {
     return(EncryptHelper.DESDecrypt(value, Encoding.Default));
 }
Пример #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));
 }
Пример #6
0
 public static string Base64Decode(string value)
 {
     return(EncryptHelper.Base64Decode(value, System.Text.Encoding.Default));
 }