[Israel.pm] File encryption

Yuval Kogman lists at woobling.org
Wed Mar 31 09:59:55 PST 2004

On Wed, Mar 31, 2004 at 19:38:46 +0300, Yaron Golan wrote:
> Hi all,
> Is there a (simple) way to encrypt a text file?
> I need to be sure that the file can't be read outside my script, in addition
> to file system permissions.

This is a very complex issue. The user who runs the script must be able
to read it too, unless you give it a setuid means of reading the key,
which is still only permission based protection, with just a layer of
cumberness added in.

Even SSL/PGP keys are normally protected only with file permissions. The
way a PGP key for a user is protected further is by keeping the key
encrypted with a password that the computer doesn't know. This way each
time the program runs it needs to ask for a password, and can only
access the key then.

What i'm trying to say is that the encryption won't matter - at the
bottom line it's the permissions that are protecting the file from other
people on the computer.

If you're still determined, look at the Crypt:: namespace on CPAN - it
implements a unified (mostly) interface to many ciphers. If you read
perltie, you can implement transperrantly encrypted files on the fly.

Good luck!

 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me throws bonsai kittens: neeyah!!!!!!!!!!!!!!!!

More information about the Perl mailing list