DBIx-PasswordIniFile
view release on metacpan or search on metacpan
name: DBIx-PasswordIniFile
version: 2.00
abstract: ~
license: ~
author: ~
generated_by: ExtUtils::MakeMaker version 6.42
distribution_type: module
requires:
Config::IniFiles: 0
Crypt::Blowfish: 0
Crypt::CBC: 0
DBI: 0
File::HomeDir: 0
Test::More: 0
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
Makefile.PL view on Meta::CPAN
#!/usr/bin/perl -w
use ExtUtils::MakeMaker;
use File::Spec;
use Cwd qw(abs_path);
use File::Basename;
use Crypt::CBC;
my $do_mysql_tests;
my $do_odbc_tests;
my $default_key = &create_DEFAULT_KEY(20);
print << "[EOM]";
############################################################
# IMPORTANT:
# This module has deprecated functions. I have keep their
# tests, although now, their execution is optional. They
Makefile.PL view on Meta::CPAN
print $fh "$k => $v, ";
}
print $fh "}\n";
close $fh;
}
sub encryptPassword
{
my $pass = shift;
my $cipher = Crypt::CBC->new( {'key' => $default_key,
'cipher' => 'Blowfish'
# Put here your preferred installed Crypt::Module
});
$cipher->start('Encript');
my $ciphertext = $cipher->encrypt_hex($pass);
$cipher->finish();
return $ciphertext;
}
Makefile.PL view on Meta::CPAN
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'DBIx::PasswordIniFile',
VERSION_FROM => 'PasswordIniFile.pm',
PRINT_PREREQ => 1,
PREREQ_PM => {
'Config::IniFiles' => 0,
'Crypt::CBC' => 0,
'Crypt::Blowfish' => 0,
'DBI' => 0,
'File::HomeDir' => 0,
'Test::More' => 0 # Only for tests execution step
},
PM => {
'PasswordIniFile.pm' => '$(INST_LIBDIR)/PasswordIniFile.pm'
, 'DEFAULT_KEY' => '$(INST_LIBDIR)/DEFAULT_KEY'
PasswordIniFile.pm view on Meta::CPAN
package DBIx::PasswordIniFile;
use strict;
use vars qw($VERSION $AUTOLOAD);
$VERSION = '2.00';
use DBI();
use Config::IniFiles;
use Crypt::CBC; # Requires Crypt::Blowfish
use File::HomeDir;
my %connect_cache;
=head1 NAME
DBIx::PasswordIniFile - Manages DBI connections with password and other params stored in a C<.ini> style file.
=head1 SYNOPSIS
PasswordIniFile.pm view on Meta::CPAN
Encrypts a clear password.
=cut
sub encryptPassword
{
my $self = shift;
my $pass = shift;
my $cipher = Crypt::CBC->new( {'key' => $self->{key_},
'cipher' => $self->{cipher_}
});
$cipher->start('Encript');
my $ciphertext = $cipher->encrypt_hex($pass);
$cipher->finish();
return $ciphertext;
}
=head2 decryptPassword
PasswordIniFile.pm view on Meta::CPAN
Decrypts an encrypted password.
=cut
sub decryptPassword
{
my $self = shift;
my $pass = shift;
my $cipher = Crypt::CBC->new( {'key' => $self->{key_},
'cipher' => $self->{cipher_}
});
$cipher->start('Decript');
my $plaintext = $cipher->decrypt_hex($pass);
$cipher->finish();
return $plaintext;
}
PasswordIniFile.pm view on Meta::CPAN
=head2 DEFAULT_KEY file
When installed, a C<DEFAULT_KEY> (NO dot prefixed) file is created at the same
directory of C<PasswordIniFile.pm>. It stores a default key used when no C<-key>
argument is specified in C<new> .
You may override this file creating your own C<.DEFAULT_KEY> (note dot prefixed)
file at your home directory.
In either case, content of this files is ONE line with a string used as key for
C<Crypt::CBC> algorithm.
=head1 SECURITY CONSIDERATIONS
In C<.ini> file, password is stored encrypted, and never in clear form. But note
that the mechanism is not completely secured because passwords are stored clear
in memory. A hack may do a memory dump and see the password.
Although with this limitation, I think the module is a good balance between security
and simplicity.
Perl v5.8.6 or above has to be installed. If not, an error
Free to wrong pool XXX not YYY during global destruction
is displayed, and Perl crashes.
This module depend on these:
Config::IniFiles
Crypt::CBC
Crypt::Blowfish
DBI
File::HomeDir
An encription module has to be installed. Default is to use Crypt::Blowfish for
encription and decryption. Or you may specify your preferred without Crypt::
prefix.
COPYRIGHT AND LICENSE
( run in 1.064 second using v1.01-cache-2.11-cpan-e1769b4cff6 )