使用Perl Crypt :: RSA但在尝试解密时获得“不完整密钥”

时间:2012-01-16 18:49:01

标签: perl encryption rsa public-key-encryption

我正在尝试使用Crypt::RSA解密邮件(我收到了n,然后我将其pq考虑在内,我也获得了e {1}}。我计算了dprogrammatically generate `d` from `p` and `q` (RSA)),但遇到了一些困难。每次运行以下代码时,我都会得到Incomplete key.

这是一个无用的错误信息。

use Crypt::RSA;

my $rsa = new Crypt::RSA;

my $privkey = bless( {
    'p' => 'NUMBER',                                                                                        
    'q' => 'NUMBER',        
    'n' => 'NUMBER',
    'Version' => '1.99',
    'Identity' => '<email>' #put your email here?                                                                                                         
                     }, 'Crypt::RSA::Key::Private' );

my $plaintext = $rsa->decrypt (
    Cyphertext => "- -----BEGIN COMPRESSED RSA ENCRYPTED MESSAGE-----                                                                                                      
Version: 1.99                                                                                                                                                              
Scheme: Crypt::RSA::ES::OAEP                                                                                                                                               

block_message_here

- -----END COMPRESSED RSA ENCRYPTED MESSAGE-----",
    Key        => $privkey,
    Armour     => 1,
    ) or die $rsa->errstr();

print $plaintext;

0 个答案:

没有答案