Cryptography in ASP.NET stopped working

Discussion in 'ASP .Net' started by landers, Oct 9, 2006.

  1. landers

    landers Guest

    Dear Fellow Developers,

    There is a little bit of code in my web app that encrypts a string, converts
    it to base64 string and uses it as a querystring parameter. It then
    redirects to this new url. The target url gets this encrypted parameter
    (not using Request.QueryString as it replaces the + for a space) and
    converts from base64 to normal string then decrypts.

    This has been running happily since January this year. There have been no
    code changes so the encrypted and decrypted results should be the same.

    The web server has recently been upgraded to .NET Framework 2.0, and since
    this upgrade odd things have been happening.

    I have a copy of the web app on two web servers (dev and live). The dev
    server is running .NET 1.1 only and the live .NET 1.1 and 2.0. When I run
    the same code against the two servers, I get two slightly different
    encrypted strings. The string returned on the .NET 2.0 server is about 16
    characters longer. It appeared to add 4 characters in 4 different places.
    Consequently, the following exception is thrown:

    System.Security.Cryptography.CryptographicException: Length of the data to
    decrypt is invalid.
    at
    System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[]
    inputBuffer, Int32 inputOffset, Int32 inputCount)

    Any ideas?

    Landers
     
    landers, Oct 9, 2006
    #1
    1. Advertising

  2. landers

    landers Guest

    Sorted now thanks.

    For some bizarre reason the encryption routine used UTF8 and the decryption
    ASCII!

    Landers

    "landers" <> wrote in message
    news:%23D%23Hdb%...
    > Dear Fellow Developers,
    >
    > There is a little bit of code in my web app that encrypts a string,
    > converts it to base64 string and uses it as a querystring parameter. It
    > then redirects to this new url. The target url gets this encrypted
    > parameter (not using Request.QueryString as it replaces the + for a space)
    > and converts from base64 to normal string then decrypts.
    >
    > This has been running happily since January this year. There have been no
    > code changes so the encrypted and decrypted results should be the same.
    >
    > The web server has recently been upgraded to .NET Framework 2.0, and since
    > this upgrade odd things have been happening.
    >
    > I have a copy of the web app on two web servers (dev and live). The dev
    > server is running .NET 1.1 only and the live .NET 1.1 and 2.0. When I run
    > the same code against the two servers, I get two slightly different
    > encrypted strings. The string returned on the .NET 2.0 server is about 16
    > characters longer. It appeared to add 4 characters in 4 different places.
    > Consequently, the following exception is thrown:
    >
    > System.Security.Cryptography.CryptographicException: Length of the data to
    > decrypt is invalid.
    > at
    > System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[]
    > inputBuffer, Int32 inputOffset, Int32 inputCount)
    >
    > Any ideas?
    >
    > Landers
    >
     
    landers, Oct 12, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark E

    ASP.NET pages stopped working

    Mark E, Jul 24, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    424
    Mark E
    Jul 24, 2003
  2. =?Utf-8?B?TWlrZQ==?=

    Help ASP.NET app suddenly stopped working

    =?Utf-8?B?TWlrZQ==?=, Feb 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    =?Utf-8?B?TWlrZQ==?=
    Feb 2, 2005
  3. =?Utf-8?B?TmFkYXYgUG9wcGxld2VsbA==?=

    ASP.NET stopped working

    =?Utf-8?B?TmFkYXYgUG9wcGxld2VsbA==?=, Jun 10, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    818
    Steven Cheng[MSFT]
    Jun 20, 2005
  4. J Rieggle
    Replies:
    1
    Views:
    467
    Curt_C [MVP]
    Jul 21, 2005
  5. Chris
    Replies:
    1
    Views:
    1,647
Loading...

Share This Page