Enterprise Library - Cryptography

  • Thread starter Thread starter Oscar Thornell
  • Start date Start date
O

Oscar Thornell

Hi,

I am trying to use the Entlib Cryptography block in an application.
I have two classes (Encrypt/Decrypt) that incorporates code from the
Quickstart exampele provided with entlib.

When trying to decrypt an encrypted string I get the following error:

'System.Security.Cryptography.CryptographicException' occurred in
mscorlib.dll
Additional information: PKCS7 padding is invalid and cannot be removed.

Does anybody know why this exception is thrown? Some sources on the Internet
indicates that it is due to the number of bytes in the chipertext. But
shouldn´t Entlib Configuration Console take care of everything for me??

Regards
/Oscar
 
I'm not sure if you are having these problems, but I have solved a similar
problem that has been troubling me all afternoon....

1. Check the IV is the same in the decrypt as encrypt (I am sure you already
know this).

2. If you are converting bytes to text using an ASCIIEncoder, or any other
8-bit encoder, it will only convert using 8-bits, i.e. a byte value of 129
will become 1!!

I had this problem because the MSDN sample uses an ASCII encoder! How
annoying!!!!! I hope this helps.
 
Back
Top