예제 #1
0
        public static byte[] DESEncrypt(byte[] data, byte[] cryptKey = null, byte[] cryptIV = null)
        {
            DESCryptoServiceProvider dESCryptoServiceProvider = EncryptHelper.CreateDESCrypto();
            MemoryStream             memoryStream             = new MemoryStream();
            CryptoStream             cryptoStream             = new CryptoStream(memoryStream, dESCryptoServiceProvider.CreateEncryptor(cryptKey, cryptIV), CryptoStreamMode.Write);

            cryptoStream.Write(data, 0, data.Length);
            cryptoStream.FlushFinalBlock();
            return(memoryStream.ToArray());
        }
예제 #2
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());
 }