PDA

View Full Version : Issues using base64 encoding



Dave C
03-04-2014, 02:33 PM
Part of my setup has the user entering information for an email server. For obvious reasons I'd rather not save their password in plaintext, but have no real need for strong encryption. Base64 encoding does the job and SB conveniently has functions to handle it. However, they don't seem to work as well as I'd hoped.

Example 1: http://i.imgur.com/gr3za0G.png
Encoding a string (%EMAILPASSWORD%, "pass") into another string (%TMPINI%, initialized to "") results in the correct encoded string ("cGFzcw=="), but with "=%EMAILUSERNAME%" added onto the end of it, which gets parsed and converted to "=dave" when saved in the INI file.

Example 2: http://i.imgur.com/M6NdB4I.png
Decoding a string (%EMAILPASSCRYPT%, "cGFzcw==") into another string (%EMAILPASSWORD%, initialized to "") results in the correct decoded string ("pass") but overlaid on the original encoded string, leaving the excess encoded characters ("cw==").

In another test, which I don't have a screenshot of, the result string was placed over an unrelated variable in a similar manner to example 2. Any ideas as to what could be causing this behavior? Is there a proper way to handle these functions that I'm missing or some sort of workaround?

Thanks,
Dave

linder
03-05-2014, 03:54 AM
Dave,

Do you have a simple .sb8 example project that allows us to reproduce the issue?

Thanks,
Friedrich

Dave C
03-05-2014, 09:08 PM
Sure, here: https://dl.dropboxusercontent.com/u/86710845/Base64Encode.sb8

It asks you to fill in four fields and stores them in an ini file in the install directory, attempting to encode the password field. Running it a second time will read the ini file (in the default setup directory) and prime those fields with the values, attempting to decode the password field.

Thanks again,
Dave

linder
03-06-2014, 11:32 AM
Dave,

Thank you. We'll review it.

Friedrich

linder
03-08-2014, 05:13 AM
Fixed in the latest internal version. For unknown reasons, a required ZeroMemory() API call was commented out in the runtime :(

Friedrich

linder
04-01-2014, 02:35 AM
Dave,

The following Development Build should fix it:

http://www.lindersoft.com/forums/showthread.php?t=42533

Friedrich

Dave C
04-22-2014, 05:45 PM
Whoops, I got so caught up in other stuff I forgot all about this. Had to make a new setup today and got the new SB8 update. Tested the Base64 stuff and it works perfectly!

Thanks a ton,
Dave

linder
04-23-2014, 02:11 AM
Thanks for the update, Dave !!!

Friedrich