daniel2milan
Newcomer
- Joined
- Sep 3, 2005
- Messages
- 7
guys i have problem to store result of encryption AES 256 BIT or 128 BIT on SQL server 2000...
can you suggest what datatype i should use for this?
herewith i attach the class... please simple change the extention into .cs
i use .net 2003 and C#
and i use this function to get the encrypted data
can you suggest what datatype i should use for this?
herewith i attach the class... please simple change the extention into .cs
i use .net 2003 and C#
and i use this function to get the encrypted data
Code:
public string AES_encrypt(string plaintext)
{
keysize = Aes.KeySize.Bits128;
byte[] plainText = new byte[16];
byte[] cipherText = new byte[16];
plainText = Encoding.Unicode.GetBytes(plaintext.PadRight(8,' '));
AesLib.Aes a = new Aes(keysize, new byte[16]);
a.Cipher(plainText, cipherText);
//label2.Text = Encoding.Unicode.GetString(cipherText);
return Encoding.Unicode.GetString(cipherText);
}
public string AES_decrypt(string chipertext)
{
//decoding
keysize = Aes.KeySize.Bits128;
byte[] cipherText = new byte[16];
byte[] decipheredText = new byte[16];
cipherText = Encoding.Unicode.GetBytes(chipertext);
AesLib.Aes a = new Aes(keysize, new byte[16]);
a.InvCipher(cipherText, decipheredText);
//textBox3.Text = Encoding.Unicode.GetString(decipheredText);;
return Encoding.Unicode.GetString(decipheredText);
}