I'm not sure why this is not working. I have a small script
that I enter the username and password via the command
prompt and it writes a dat file with the encrypted data.
This works great.

In my snippet below I read in the dat file, decript the
username and password "It does work fine" and put it in my
connect string for DBI. But the error is "Login failed for
user 'sa'". Is there some problem decrypting the data and
using it in the connect string?



#!/Perl

use DBI;
use Crypt::TripleDES;

# -----------------------------------------
# Get dat file.

open(DATFILE,"encrypt.dat") || die "Can't open encrypt.dat
file $^E";
while(<DATFILE>) {
        chomp;
        ($sa,$pass) = split(/,/,$_);
}

# -----------------------------------------

$des         = new Crypt::TripleDES;
$passphrase  = "Thepassphrase";

# -----------------------------------------
# SA decrypt

my $sa_decrypt   = $des->decrypt3($sa, $passphrase);
my $pass_decrypt = $des->decrypt3($pass, $passphrase);

# -----------------------------------------

my $dbh = DBI->connect("DBI:ODBC:MagicTSD", "$sa_decrypt",
"$pass_decrypt",
      { RaiseError => 1, PrintError => 1, AutoCommit => 1
});
      $dbh->{LongTruncOk} = 1;
      $dbh->{LongReadLen} = 2**16 - 8 ; #buffer size=65,528


Thank you
Allan
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to