Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

It doesn't need to be super-strong. Just enough to prevent snooping. Locking just the program won't be enough because anything that can read DBM could read it. I know how to validate passwords, but I wondered if there was a common way to do this. It' a console based program to manage entries in a logbook. It will need to be able to unlock the database for multiple runs of the program as a run is neccesary to execute a command (such as add an entry, delete, list, etc.).
  • Comment on Is there any way to add password based encryption to a DBM database?

Replies are listed 'Best First'.
Re: Is there any way to add password based encryption to a DBM database?
by TheoPetersen (Priest) on Feb 19, 2001 at 19:11 UTC
    Any solution which applied to the database as a whole (such as encrypting the entire file, and decrypting it at program start) would be vulnerable in that someone else could read the data while your program ran.

    It sounds as if the simple solution would be to encrypt the data going into the database, and decrypt it on retrieval. Crypt::xDBM_File will do that for you. You'll also need an acceptable encryption module such as Crypt::DES.

    A simpler solution for this would be to use strict file protection, if the program is run by a single user, or to move the data to a database such as MySQL which provides built-in password protection.