Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encrypt/ Decrypt text file in Delphi?

Hi i would like to know best encryption technique for text file encryption and ecryption.

My Scenario:

I have software having two type of users Administartor and Operators. Our requirement is to encrypt text file when Administrator enter data using GUI and save it. That encrypted file would be input for Operator and they just need to select it and use that file. Here file should be automatically decrypt data for further calculation when Operator select those files.

Please help me which encryption/ decryption technique should i use?

like image 615
Hemant Kothiyal Avatar asked May 06 '10 10:05

Hemant Kothiyal


1 Answers

A golden rule when doing crypto is to understand that cryptography as a whole it is very difficult.

There are a multitude of different approaches/algorithms to choose from, and no single algorithm/method can be said to be the best one. It all depends on your needs and possibilities to affect application distribution etc.

An example of a potentially problematic situation is that in your scenario the decryption "key" needs to be distributed with the application(s) and might make it insecure. This is generally referred to as the "Key Distribution" problem.

A good place to start reading about crypto is http://en.wikipedia.org/wiki/Cryptography.

As for ready made stuff for Delphi there are a few good packages available:

  • DEC v5.2 - http://blog.digivendo.com/2008/11/delphi-encryption-compendium-dec-52-for-d2009-released/
  • DCPCrypt - http://www.cityinthesky.co.uk/cryptography.html

Torry's pages also has a long list of components:

  • http://www.torry.net/pages.php?id=519
  • http://www.torry.net/pages.php?id=312

I strongly recommend you use some of the existing implementations and not start to do your own, since creating a secure working crypto algo is very very difficult.

like image 162
K.Sandell Avatar answered Oct 21 '22 11:10

K.Sandell