cgi问题

cgi问题

cgi问题
我再做cgi的时候总是出现这个问题,请各位告诉指教

BEGIN { push @INC, qw(/cgi-bin/lib/) }
use DBI;
use CGI qw/:standard/;
use sinasms::cookie;

my ($user,$group,$power);
$user = &get_cookie("ADMIN_SMS");
$group = &get_cookie("GROUP_SMS");
$power = &get_cookie("POWER_SMS");

print "$user\n$group\n$power\n";


sub get_cookie(){
use Crypt::CBC;
my $cipher = Crypt::CBC->new( {'key' => '4mOyGt2w9pogJB2',
'cipher' => 'Blowfish',
'iv' => '$KJh#(}q',
'regenerate_key' => 0, # default true
'padding' => 'space',
'prepend_iv' => 0,
'pcbc' => 1 #default 0
});
my ($cookie_key)=@_;
my($chip, $val, %cookie);
foreach (split(/; /, $ENV{'HTTP_COOKIE'})) {
s/\+/ /g;
($chip, $val) = split(/=/,$_,2); # splits on the first =.
$chip =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
$val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
$cookie{$chip} .= "\1" if (defined($cookie{$chip})); # \1 is the multiple separator
$cookie{$chip} .= $val;
}

$cookie_key = $cipher->encrypt($cookie_key);
my ($keyChg,$valueChg);

$keyChg = &ascIItoNo($cookie_key,"asc");
$valueChg = &ascIItoNo($cookie{$keyChg},"no");
$cookie{$keyChg} = $cipher->decrypt($valueChg);
return $cookie{$keyChg};
}
总是说If specified by -literal_key, then the key length must be equal to the chosen cipher's key length of 56 bytes这个错误。本人刚用perl不长时间。
把regenerate_key改成lite.
把regenerate_key改成literal_key
请问这个错误的原因出在哪里啊?
请问这个错误的原因出在哪里啊?
Crypt::CBC的版本问题吧.
Crypt::CBC的版本问题吧
楼主用的cipher为blowfish.
楼主用的cipher为blowfish,而且没有指定 -keysize,看 cpan 上 Crypt::CBC 的文档便知:[quote]If -keysize is not specified, then Crypt::CBC will use the maximum length Blowfish key size of 56 bytes (448 bits).[/quote]