Here is my encrypt method...
private
byte[] Encrypt(byte[] bytes){
key = new byte[8];
iv = new byte[8];
for (int x = 0; x < 8; x++)
{
key[x] = Convert.ToByte(textBox3.Text[x]);
iv[x] = Convert.ToByte(textBox4.Text[x]);
}
DESCryptoServiceProvider cryptProvider = new DESCryptoServiceProvider();
ICryptoTransform transform = cryptProvider.CreateEncryptor(key, iv);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, transform, CryptoStreamMode.Write);
cs.Write(bytes, 0, bytes.Length);
cs.FlushFinalBlock();
ms.Flush();
return (ms.GetBuffer());
}
Replies
Know the answer? Post it — somebody with the same question will find it here.