[ create a new paste ] login | about

Link: http://codepad.org/nBIS91M4    [ raw code | output | fork ]

Perl, pasted on Jan 16:
use Crypt::RSA;
use Crypt::RSA::ES::OAEP;
use Crypt::RSA::Key::Private;
use Crypt::RSA::Key;
use Crypt::RSA::Primitives;
use Math::Pari ':int';

my $ct = "-----BEGIN COMPRESSED RSA ENCRYPTED MESSAGE-----
Version: 1.99
Scheme: Crypt::RSA::ES::OAEP

<encrypted code here>
-----END COMPRESSED RSA ENCRYPTED MESSAGE-----";

my $keychain = new Crypt::RSA::Key;
my ($public, $key) = $keychain->generate ( 
                              e => 65537,
							  p => '<factor 1>',
							  q => '<factor 2>'
                             ) or die $keychain->errstr();
							 
print "\ne: ".$key->e."\np: ".$key->p."\nq: ".$key->q."\n\nd: ".$key->d."\nn: ".$key->n."\nphi: ".$key->phi."\n";
							 
print "\nEverything seems to be ok.\n\n" if $key->check();
			
my $rsa = new Crypt::RSA;
				
my $pt = $rsa->decrypt( Key => $key, Ciphertext => $ct, Armour => 1 )   || 
                die $rsa->errstr;				
print $pt;


Output:
1
2
Can't locate Crypt/RSA.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i486-linux /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i486-linux /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at line 1.
BEGIN failed--compilation aborted at line 1.


Create a new paste based on this one


Comments: