无法解密消息PHP singpolyma / openpgp-php

时间:2018-07-13 08:06:10

标签: php encryption pgp

我无法使用以下代码解密邮件。 我替换了以下变量。

$keyASCII = I put my PGP key.
$msgASCII =I put my encrypted message.
and I replaced $argv[2] with my pass.

// USAGE: php examples/deASCIIdeCrypt.php secretkey.asc password message.asc
// This will fail if the algo on key or message is not 3DES or AES



require_once dirname(FILE).'/../lib/openpgp.php';
require_once dirname(FILE).'/../lib/openpgp_crypt_rsa.php';
require_once dirname(FILE).'/../lib/openpgp_crypt_symmetric.php';
$keyASCII = file_get_contents($argv[1]);
$msgASCII = file_get_contents($argv[3]);
$keyEncrypted = OpenPGP_Message::parse(OpenPGP::unarmor($keyASCII, 'PGP PRIVATE KEY BLOCK'));
// Try each secret key packet
foreach($keyEncrypted as $p) {
if(!($p instanceof OpenPGP_SecretKeyPacket)) continue;
$key = OpenPGP_Crypt_Symmetric::decryptSecretKey($argv[2], $p);
$msg = OpenPGP_Message::parse(OpenPGP::unarmor($msgASCII, 'PGP MESSAGE'));
$decryptor = new OpenPGP_Crypt_RSA($key);
$decrypted = $decryptor->decrypt($msg);
var_dump($decrypted);
}

I tried to open the message in desktop tool its open only in php it will not open it

将加载并在出现超时页面后失败。

0 个答案:

没有答案