package Config::Confmanager; use warnings; use strict; require Exporter; our @ISA = 'Exporter'; our @EXPORT=qw(Encrypt Decrypt); use Crypt::CBC; #CPAN Module For Encryption And Decryption { my $crypto = Crypt::CBC->new( {'key' => 'passport', 'cipher' => 'DES', 'iv' => '$KJh#(}q', 'regenerate_key' => 0, # default true 'padding' => 'space', 'prepend_iv' => 0 }); sub Encrypt { my($encryptstring) = @_; my $cipherencryptstring = $crypto->encrypt($encryptstring); die "Could not Encrypt requested string" unless $cipherencryptstring; return $cipherencryptstring; } sub Decrypt { my($decryptstring) = @_; my $cipherdecryptstring = $crypto->decrypt($decryptstring); die "Could not Decrypt requested string" unless $cipherdecryptstring; return $cipherdecryptstring; } } 1; #### #!/usr/bin/perl use strict; use warnings; use Config::Confmanager; my $cleartext = "la dee dah"; my $encrypted = Encrypt($cleartext); my $decrypted = Decrypt($encrypted); print "$cleartext\n"; print "$encrypted\n"; print "$decrypted\n";