daniel2milan Posted October 7, 2007 Posted October 7, 2007 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 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); }Aes.txt Quote
Administrators PlausiblyDamp Posted October 8, 2007 Administrators Posted October 8, 2007 As both the functions return / accept string based data then depending on the size likely to be returned either a varchar or text data type might be the best. Although as you are using unicode strings nvarchar or ntext is probably more suitable. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.