Base64 decoding - BUG????

From: Mark Harris (anonymous_at_discussions.microsoft.com)
Date: 02/24/04


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



Relevant Pages

  • RE: 2007 User Level Security
    ... encrypted string. ... the way I use it is to encrypt user names and passwords and store the ... Dim prp As Property ... Dim dbs As Object, prp As Variant ...
    (microsoft.public.access.modulesdaovba)
  • Re: Workable encryption in Tcl??
    ... The longest string would be about the length ... How to encrypt a string ... nothing about binary formats. ... ># Perform ECB mode encryption on a plaintext block of BINARY data. ...
    (comp.lang.tcl)
  • RE: Using Win32 CryptDecrypt to Decrypt RijndaelManaged
    ... I figured out how to use RijndaelManaged with AES in the C++ app. ... C++ crypto WILL successfully decrypt the .NET generated ... I am trying to write a Win32 app that can decrypt that string using the ... I can get both to encrypt and decrypt successfully in their own projects, ...
    (microsoft.public.platformsdk.security)
  • Re: Decryptionfailed to bring original text back....
    ... cryptography, but now using them on web.config, any idea, I like to ... There isn't really much reason to encrypt a .NET string with ... what happen when you decrypt the encrypted ...
    (microsoft.public.dotnet.security)
  • Re: Decryptionfailed to bring original text back....
    ... The thing to know when you are encrypting string data (as opposed to ... arbitrary binary data) is that if you have a .NET string object, ... Encrypt() and Decrypt. ... //Variable Telling if Crypto or Managed object is ...
    (microsoft.public.dotnet.security)