[sf-perl] OT: Secure password storage

Randal L. Schwartz merlyn at stonehenge.com
Thu Jan 15 09:06:54 PST 2009

>>>>> "David" == David Alban <extasia at extasia.org> writes:

David> also, i've taken to placing "garbage" in all of my pgp-encrypted
David> files.  i use the following to generate it:

David>     #!/usr/bin/perl

David>     use warnings;
David>     use strict;

David>     $ENV{ PATH } = '/sbin:/bin:/usr/sbin:/usr/bin';

David>     my $size = shift || 1024;

David>     my $s;

David>     open my $fh, '/dev/random' or die "$0: can't open /dev/random: $!\n";
David>     if ( sysread( $fh, $s, $size ) != $size ) {
David>       die "sysread failed to read $size bytes from /dev/random: $!\n";
David>     } # if
David>     close $fh;

David>     my $cmd = "openssl base64";

David>     open my $CMD, "|$cmd" or die "$0: can't open command '$cmd': $!\n";
David>     print $CMD $s;
David>     close $CMD;

You missed "openssl rand -base64 1024", eh?

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

More information about the SanFrancisco-pm mailing list