Mark Funk said:
>I keep the username and password hardcode
>(in plain text) in the script.
>I would like to use an encrypted method.
>What do you do?

I use Crypt::CBC with Blowfish cipher.
I encrypt the password, record in config file.
Then in scripts that use that password,
I have a routine that slurps in the config
file, and decrypts the password.

my $configfile = "/path/to/conf/app.cfg";
unless ($the = do $configfile) {
  die "couldn't parse $configfile: [EMAIL PROTECTED]" if $@;
  die "couldn't do $configfile: $!\n"    unless defined $configfile;
  die "couldn't run $configfile\n"       unless $configfile;
  }

my $cipher = Crypt::CBC->new( {'key'             => '[EMAIL PROTECTED]',
                              'cipher'          => 'Blowfish',
                              'iv'              => '$KJh#(}q',
                              'regenerate_key'  => 0,   # default true
                              'padding'         => 'standard',
                              'prepend_iv'      => 0,
                              'pcbc'            => 1  #default 0
                           });

my $ciphertext = "$the->{ldappw}";
my $ldappw = $cipher->decrypt($ciphertext);

best,

 /dennis

------------------------------------------------

Methods for predicting the future:
1) read horoscopes, tea leaves, tarot cards, or crystal balls . . .
collectively known as "nutty methods;"
2) put well-researched facts into sophisticated computer . . .
commonly referred to as "a complete waste of time."

— Scott Adams

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to