Enterprise Library - Cryptography

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oscar Thornell

    Enterprise Library - Cryptography

    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.Securit y.Cryptography. CryptographicEx ception' 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


  • David Whitchurch-Bennett

    #2
    RE: Enterprise Library - Cryptography

    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.

    "Oscar Thornell" wrote:
    [color=blue]
    > 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.Securit y.Cryptography. CryptographicEx ception' 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
    >
    >
    >[/color]

    Comment

    Working...