PDA

View Full Version : Encrypt in the ini file



Mauricio
06-04-2007, 04:36 AM
Hi all,
During installation I have to ask to the user some things about the MSSQL connection (server, database, user and password). Then, I need to write this in an ini files but I want to encrypt the password. Is there any way to do this?
At the same time then I need to decrypt this from my program so I will need to know how to do it.
Thanks in advance.

Mauricio

linder
06-04-2007, 04:46 AM
Mauricio,

If you have an encryption DLL (e.g. DES3, AES, etc.), you can call it directly from the installer to encrypt the data and write the result to the INI file. No problem! You can use the same DLL from within your application to decrypt the data.

Friedrich

Mauricio
06-04-2007, 04:50 AM
Hi Friedrich,
thanks for your answer. I'm using Clarion and the idea was to use blowfish to encrypt and decrypt this (there is a free template for that). I will see how to do it and, if I can't do it, I will ask again.
Regards,

Mauricio

linder
06-04-2007, 04:57 AM
Hi Mauricio,

Yes, this should work fine. You can compile that Blowfish code into a DLL and call it from the install to encrypt and later from your application to decrypt data.

Perhaps you also have to use Encode Base64 (built-in installer function) if the Blowfish return value includes "non-writable" characters (e.g. ASCII 19 etc.). You cannot write such non-writable characters to an INI file. Then, when you decrypt the string from your application, use your own Decode Base64 function before you decrypt the string. I think there is also some Decode Base64 freeware source code available for Clarion.

Friedrich

Mauricio
06-04-2007, 05:06 AM
Hi Friedrich,
I was thinking on encrypt using the Hexadecimal option so I think I won't need to use Encode and Decode. Now I'm watching the docs for J-Blowfish to see what to do.
Thanks again.

Mauricio

linder
06-04-2007, 05:10 AM
Mauricio,

I agree. J-Blowfish would be the perfect solution! It's pure Clarion source so it should be possible to compile it into a DLL.

Friedrich