Last post Oct 14, 2008 08:42 AM by Wizard!
Oct 13, 2008 10:23 AM|Wizard!|LINK
I am having this strange problem... I have to pass encrypted data, between 2 web servers. I am using a combination of RC4 and MD5 in order to encrypt the data. Since the string provided has all kinds of special characters, I am converting the string to HEX
to be valid for querystring/form.
The problem is that on the other server, using exactly the same routine I am getting a different HEX value from the same string... The differences are 5-6 on a string of 512 length, however when decrypting even a single character, returns completly different
results. I tested those functions on the same machine (localhost), and still having problems...
Those are the fucntions:
Private Function StringToHex(ByVal text As String) As String
Dim hex As String
For i As Integer = 0 To text.Length - 1
hex &= Asc(text.Substring(i, 1)).ToString("x").ToUpper
Private Function HexToString(ByVal hex As String) As String
Dim text As New System.Text.StringBuilder(hex.Length \ 2)
For i As Integer = 0 To hex.Length - 2 Step 2
text.Append(Chr(Convert.ToByte(hex.Substring(i, 2), 16)))
Oct 13, 2008 11:47 AM|DkUltra|LINK
Skip the hex stuff and use server.urlencode(yourstring) and server.urldecode(querystring)
Also, Take a look at
Hope this helps
Oct 14, 2008 03:00 AM|Wizard!|LINK
DkUltra thanx for your answer. Have tried that before, however I am getting this error, that is why I used hex:
System.Web.HttpRequestValidationException: A potentially dangerous Request.QueryString value was detected from the client (token="...õ�89�eeG±k<KƒÍ[[‘“]v-rTïš]Ü`...").
Even after using the validateRequest="false" page directive, I am getting errors that URI cannot contain new line characters.
Oct 14, 2008 08:23 AM|DkUltra|LINK
That is wierd. A person could create a web service for the encryption/decryption and host on only one of the servers.
Do the servers have the same operating system /service pack ?
Oct 14, 2008 08:42 AM|Wizard!|LINK
No, the servers are different. Sender is on Server 2003, receiver is on Server 2000.
However, I managed to make it using another routine of RC4 encryption I found on the web, that produces only alphanumeric character and not unicode characters as the previous one.
Thank you for your time :)