Hello evenryone,
In one of my web application i used the RC2 encryption / decryption for password. I use email id as key. Suddenly i found that it gives error for one unique password (12345678) and email id ([email protected]).
Application perform encryption successfully but when i try to decrypt my password again it gives error "System.Security.Cryptography.CryptographicException: Length of the data to decrypt is invalid.
at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadToEnd()"
If i do any changes in email id or password it works perfectly.
Is there is some problem with RC2 decryption for some values?
Please help me to fix this error.
Loading
Pasan RatnayakePosted Oct 8, 2010, 7:56 AM
I am interested in cryptography quite a bit so I would like to help you. But I am afraid the given information is not at all sufficient to help you. There are alot of questions such as what is your IV ? RC2 encryption default implementation use a 128 bit key and IV, but you are saying you are using email id as your key which is a variable length key.
This information tells me that this is a customized implementation of RC2 so there is no way of guessing what the problem is even. I have got similar error messages when there is a encoding mismatch of data but since your code is working fine and this is the only known exception, I would like to get more information.
Hopefully I can help you. =) Regards