Base64 decoding - BUG????
From: Mark Harris (anonymous_at_discussions.microsoft.com)
Date: 02/24/04
- Next message: Hernan de Lahitte: "Re: security exception when calling another dll"
- Previous message: Alessandro Belli: "how to set user propertyes for an encrypted (win2k 2k3) with vb.net?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 24 Feb 2004 04:31:05 -0800
Hi all
the idea of what i'm doing it to encrypt a string, and then encode it so that it can be transmitted via a webservice ... and the the XMLtextReader / writer was used in an attempt to perform this.
however, when i try to decode the Base64 string produced by the Encrypt / Base64Encode, it doesn't come out with the same byte array as was originally passed in ... it appears to have been "cropped"!
For a couple of days now, i thought this was something I was doing wrong ... but to test the theory, i used the BinHex encoding instead ... and "lo and behold", it encrypts / encodes >> decodes / decrypts perfectly fine!??
The only thing of note is that the last byte in the array after the initial encryption (of "la la la"!!) was 32 (ie. a Space!) .. so i am wondering if Base64 has an issue when trying to encode spaces. To be honest, the base 64 version does seem to work on certain strings, and the problem only really popped up when a an attempt was made by the webservice to transmit a signicantly larger string ... my guess now is that the larger string just increased the probability of a chr(32) appearing in the byte array after encryption!?
Anyway, i'm sticking with the BinHex version for now (seeing as it works!?) ... although the resulting string that get's transmitted is now significantly larger! But hey, at least it's encrypted now!
But, if anyone knows alot more about Base64 than i do, and can maybe validate / refute my theory, it wud be appreciated!? lol Basically, i've now wasted alot of time on this, when all along, it was a built-in .Net encoding algorithm that wasn['t behaving as expected!? my bad ...maybe ... doesn't make my project manager feel any better about it!? lol
Cheers
Mark
- Next message: Hernan de Lahitte: "Re: security exception when calling another dll"
- Previous message: Alessandro Belli: "how to set user propertyes for an encrypted (win2k 2k3) with vb.net?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|