Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cryptography in ASP.NET stopped working

Reply
Thread Tools

Cryptography in ASP.NET stopped working

 
 
landers
Guest
Posts: n/a
 
      10-09-2006
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.CryptographicExceptio n: Length of the data to
decrypt is invalid.
at
System.Security.Cryptography.CryptoAPITransform.Tr ansformFinalBlock(Byte[]
inputBuffer, Int32 inputOffset, Int32 inputCount)

Any ideas?

Landers


 
Reply With Quote
 
 
 
 
landers
Guest
Posts: n/a
 
      10-12-2006
Sorted now thanks.

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

Landers

"landers" <(E-Mail Removed)> wrote in message
news:%23D%23Hdb%(E-Mail Removed)...
> 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.CryptographicExceptio n: Length of the data to
> decrypt is invalid.
> at
> System.Security.Cryptography.CryptoAPITransform.Tr ansformFinalBlock(Byte[]
> inputBuffer, Int32 inputOffset, Int32 inputCount)
>
> Any ideas?
>
> Landers
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Cryptography in J2SE 1.3.1 Zheng Da Java 2 04-29-2006 02:47 PM
Re: "System.Security.Cryptography.CryptographicException: Bad Data" Message Dei401 ASP .Net 0 02-02-2005 04:30 PM
Generating hashes (System.security.cryptography) Mauricio Correa L. ASP .Net 1 06-18-2004 01:45 PM
cryptography library a_the_s@hotpop.com C++ 1 11-02-2003 10:42 PM
cryptography software Apple Java 1 10-12-2003 09:39 AM



Advertisments