Jump to content
Registration disabled at the moment Read more... ×
Lainkes

Encrypt ini file

Recommended Posts

Hello,

 

For now, I put my database connection info in an INI file.

But due to security, I was wondering if I could encrypt that file so that users cannot read that information.

Or is there another solution to protect my INI file?

 

Thanks for your advice

 

Greetings

 

Lainkes

Share this post


Link to post

Hi...:classic_cool:

Quote

I was wondering if I could encrypt that file so that users cannot read that information.

...encrypt not the file, only the information. 😉

 

XML like INI:

<Password>xbWONK6X9KT/Pq1LFcV+4VRA8tePadM1yL+iVp3hA4rkgkbckH/EG00NYnuCkN22Zyg=</Password>

There are several methods of encryption. DEC for example: https://github.com/MHumm/DelphiEncryptionCompendium

 

:classic_cool:

  • Like 1

Share this post


Link to post

Are you looking for strong cryptography against hackers or simple data scrambling so the casual user won't be able to see the data?

Share this post


Link to post

Thanks, it makes more sence to encrypt only the data.

It's for more advanced and curious internal users. So they cannot see the content.

 

 

Share this post


Link to post
18 minutes ago, Lainkes said:

It's for more advanced and curious internal users. So they cannot see the content.

Then you can use very basic scrambling technique. For example base64 encoding. Additionally to base64, you can apply a simple XOR of each character.

This won't resist to any serious hacker but none of "normal" user, even with good computer knowledge will not pass that kind of scrambling.

Base64 routines are available in Delphi RTL and is many software. XOR encryption is so simple, you can write it yourself in a few minutes.

 

Alternatively, you can use stronger cryptography (Lots of libraries for Delphi, one is there https://github.com/MHumm/DelphiEncryptionCompendium) but then you need to hide the key somewhere (hardcoded in your program or store somewhere). You are almost back to the beginning.

 

Edited by FPiette

Share this post


Link to post

Thanks, I'll try to search more info about this topic.

If someone has a small example, I would appreciate. I never used 3th party components.

 

Share this post


Link to post

You can consider not to use the INI but the Windows Credential Manager for storing information.

Very easy to use (read/write) from Delphi.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×