无法在@INC中找到模块Crypt :: OpenSSL :: Random的可加载对象(@INC包含:/opt/lampp/lib/perl5/5.10.1

时间:2012-12-04 11:48:55

标签: perl openssl lampp

#! /usr/bin/perl
#use strict;
use Crypt::OpenSSL::Random;
use Crypt::OpenSSL::RSA;
use Data::Dumper ;

my $rsa = Crypt::OpenSSL::RSA->generate_key(1024); # or

print "private key is:\n", $rsa->get_private_key_string();
print "public key (in PKCS1 format) is:\n",     
$rsa->get_public_key_string();
print "public key (in X509 format) is:\n", 
$rsa->get_public_key_x509_string();

$rsa->use_md5_hash(); # use_sha1_hash is the default
$signature = $rsa->sign($plaintext);
if($rsa->verify($plaintext,$signature)) {
print "Signed correctly\n"; }


my $rsa = Crypt::OpenSSL::RSA->generate_key(2048); # or
my $rsa_priv = Crypt::OpenSSL::RSA->new_private_key($rsa->get_private_key_string() );
my $rsa_pub = Crypt::OpenSSL::RSA->new_public_key( $rsa->get_public_key_string() );

my $ciphertext = $rsa_pub->encrypt($plaintext) ;
print 'result'.$ciphertext;

apache运行时发生的错误(为了便于阅读而添加了换行符):

Can't locate loadable object for module Crypt::OpenSSL::Random in @INC (@INC contains: 
   /opt/lampp/lib/perl5/5.10.1/i686-linux
   /opt/lampp/lib/perl5/5.10.1
   /opt/lampp/lib/perl5/site_perl/5.10.1/i686-linux
   /opt/lampp/lib/perl5/site_perl/5.10.1
   .
   /opt/lampp) at /opt/lampp/htdocs/cryptos1.pl line 3
Compilation failed in require at /opt/lampp/htdocs/cryptos1.pl line 3.
BEGIN failed--compilation aborted at /opt/lampp/htdocs/cryptos1.pl line 3. , 

从shell中显示正确的输出。问题出在哪儿?我错过了什么?我安装了一切。

0 个答案:

没有答案