view release on metacpan or search on metacpan
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Business-OnlinePayment-StoredTransaction
version: 0.01
version_from: lib/Business/OnlinePayment/StoredTransaction.pm
installdirs: site
requires:
Business::OnlinePayment: 2.01
Crypt::Blowfish: 2.09
Crypt::CBC: 2.12
Crypt::OpenSSL::RSA: 0.21
Digest::MD5: 2.33
MIME::Base64: 3.01
Storable: 2.12
Test::More: 0.47
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17
Makefile.PL view on Meta::CPAN
use 5.008004;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'Business::OnlinePayment::StoredTransaction',
VERSION_FROM => 'lib/Business/OnlinePayment/StoredTransaction.pm', # finds $VERSION
PREREQ_PM => { Business::OnlinePayment => '2.01',
Crypt::OpenSSL::RSA => '0.21',
Crypt::CBC => '2.12',
Crypt::Blowfish => '2.09',
Storable => '2.12',
MIME::Base64 => '3.01',
Test::More => '0.47',
Digest::MD5 => '2.33'}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Business/OnlinePayment/StoredTransaction.pm', # retrieve abstract from module
AUTHOR => 'mock <mock@obscurity.com>') : ()),
);
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
Business::OnlinePayment
Crypt::OpenSSL::RSA
Crypt::CBC
Crypt::Blowfish
MIME::Base64
Storable
Test::More
Digest::MD5
COPYRIGHT AND LICENCE
Copyright (C) 2004 by mock <mock@obscurity.org>
lib/Business/OnlinePayment/StoredTransaction.pm view on Meta::CPAN
package Business::OnlinePayment::StoredTransaction;
use 5.008004;
use strict;
use warnings;
use Carp;
use Business::OnlinePayment;
use Crypt::OpenSSL::RSA;
use Crypt::CBC;
use Storable;
use MIME::Base64;
use Digest::MD5;
our @ISA = qw(Business::OnlinePayment);
our @EXPORT_OK = ();
our @EXPORT = ();
lib/Business/OnlinePayment/StoredTransaction.pm view on Meta::CPAN
$self->map_fields();
my %content = $self->content();
my $public_key = $self->public_key();
croak "No public key found in 'password'" unless $public_key;
if ($actions{$content{action}}) {
my $rsa_pub = Crypt::OpenSSL::RSA->new_public_key($public_key);
my $plaintext = Storable::nfreeze(\%content);
my $seckey = Digest::MD5::md5_hex(rand());
my $encseckey;
eval { $encseckey = $rsa_pub->encrypt($seckey) };
my $cipher = Crypt::CBC->new( {'key' => $seckey,
'cipher' => 'Blowfish',
});
my $ciphertext = $cipher->encrypt($plaintext);
$ciphertext = encode_base64($ciphertext);
$ciphertext =~ s/\s+//g;
$encseckey = encode_base64($encseckey);
$encseckey =~ s/\s+//g;
$ciphertext = "$encseckey:$ciphertext";
if ($ciphertext and !$@) {
$self->is_success(1);
lib/Business/OnlinePayment/StoredTransaction.pm view on Meta::CPAN
=head2 EXPORT
None by default.
=head1 SEE ALSO
Business::OnlinePayment
Crypt::OpenSSL::RSA
Crypt::Blowfish
Crypt::CBC
Business::OnlinePayment::StoredTransaction::Unstore
=head1 AUTHOR
mock, E<lt>mock@obscurity.org<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2004 by mock
lib/Business/OnlinePayment/StoredTransaction/Unstore.pm view on Meta::CPAN
package Business::OnlinePayment::StoredTransaction::Unstore;
use 5.008004;
use strict;
use warnings;
use Carp;
use Crypt::OpenSSL::RSA;
use Crypt::CBC;
use Storable;
use MIME::Base64;
our @ISA = qw();
our @EXPORT_OK = ();
our @EXPORT = ();
our $VERSION = '0.01';
lib/Business/OnlinePayment/StoredTransaction/Unstore.pm view on Meta::CPAN
croak "missing 'authorization'" unless $self->{'authorization'};
croak "bad authorization" unless $self->{'authorization'} =~ /:/;
my ($seckey, $ciphertext) = split /:/, $self->{'authorization'};
$seckey = decode_base64($seckey);
$ciphertext = decode_base64($ciphertext);
my $rsa_priv;
eval {$rsa_priv = Crypt::OpenSSL::RSA->new_private_key($privkey)};
croak $@ if $@;
eval {$seckey = $rsa_priv->decrypt($seckey)};
croak $@ if $@;
my $cipher = Crypt::CBC->new( {'key' => $seckey,
'cipher' => 'Blowfish',
});
my $plaintext = $cipher->decrypt($ciphertext);
croak "no plaintext" unless $plaintext;
my $data = Storable::thaw($plaintext);
$self->{data} = $data;
return $self;
}
#returns hash containing content or single value from hash if given a key
lib/Business/OnlinePayment/StoredTransaction/Unstore.pm view on Meta::CPAN
and get, which either returns a hash of all the content, or an individual
value if provided a key. See the synopsis for details of usage.
=head2 EXPORT
None by default.
=head1 SEE ALSO
Business::OnlinePayment::StoredTransaction
Crypt::CBC
Crypt::Blowfish
Crypt::OpenSSL::RSA
Storable
MIME::Base64
=head1 AUTHOR
mock, E<lt>mock@obscurity.org<gt>
=head1 COPYRIGHT AND LICENSE
t/Business-OnlinePayment-StoredTransaction.t view on Meta::CPAN
),
, 'add some content');
ok($transaction->submit(),'submit content');
ok($transaction->is_success(), 'it should succeed');
my $auth = $transaction->authorization();
ok($auth, 'should have an auth');
use MIME::Base64;
use Crypt::OpenSSL::RSA;
use Crypt::CBC;
use Storable;
my $privkey = '-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDqCih9AmZurFhxoOEsoIpL7wHnA0vi8eopVGfJiFSXldnemIxC
UY8tdk0hXSUwtEogQ2yeFB8+Wsl4S0oStFb2kGPrH2cDF9UjWTWFMjvE+4GO0Asz
q3Ek0gnAQazVs89AjFlDuaDiCGHryhIprbA7wbZVWmCQKyXcCavSgf0Y0QIDAP//
AoGABlQEpEXw4vbz6yZwvRGkTunpSxRV5ZzIHZ4x3JjYQmGDoZRpf0SLz5p+eGFp
HtY+x1YaCfA9OIDU62GUhk3+l+QIuhjV0/2cnAQ8x81r82zmbioWcmkAyLYKrkgS
mKJHfWB2u7YRnTJLTPQ03GnTTNSJvxCRm9ns3xCJbe4dig8CQQD9ZMYMSRynzRXT
ri/yvEepml/Evs7M1aRsnGW19VddPi2HEFlbuHUiHxN661wH14fovMQfHyLHjRa4
t/Business-OnlinePayment-StoredTransaction.t view on Meta::CPAN
ok($cipher, 'better have some data');
ok($key, 'better have some data here too');
my $rsa_priv;
eval {$rsa_priv = Crypt::OpenSSL::RSA->new_private_key($privkey)};
ok(!$@, 'looks like a valid private key');
my $seckey;
eval {$seckey = $rsa_priv->decrypt($key)};
ok(!$@, 'seckey decrypted');
my $ci = Crypt::CBC->new( {'key' => $seckey,
'cipher' => 'Blowfish',
});
my $plaintext = $ci->decrypt($cipher);
ok($plaintext, 'better be some plaintext');
my $data = Storable::thaw($plaintext);
#use Data::Dumper;