我对Encryption
没有任何问题,但我无法Decrypt
该文字。
我收到的回复只是false
。代码看起来像这样
putenv("GNUPGHOME=/tmp");
$gpg = new \gnupg();
$key = $gpg->import($user->pgp_key);
$gpg->addencryptkey($key['fingerprint']);
$encrypted_text = "
-----BEGIN PGP MESSAGE-----
hQEMA8b5QPvIxFcnAQgAl55QDu/QPn5A16Ag0+GAGwWzFVJcj4zGQMTVMHRNoZJw
h29gWkIjXXtgyBxsQCv+tiLxuyBmtUR1r45RDyZgtunrATtJAMBHOEORDZ8bRQps
87mY5Tw3VklLokAahjnJiqzY/HrodjQLXMdk8FXXoNk+SvZq+gdr5XVqAEtKgn/8
24NMzWD+k+zZL+8GLi3Fb2C6C2/go4oJBW+pTzNZF1yIkaIqpJp/T2nvp879bi1s
t8sUbGEUyVcJ8/qdQs1D4tq3g327RypHV9KV0nJ8fCCjN186uKrn4EUNaOB9p3RQ
IbeP94V5jGDNJdfdUOcfuiHS74cRLgNsSGf2S80ipNKSATApW498uYae7EtSHK/N
tEli+Mg3ZgJZ6iSoBEPsCSSSQmBprmha8W9SoXRT1LhvMXZZLdGGOCMOSgbS5cx1
Sl23jUK7xANGKwwyw4tSNh0G6yjULJ/bU00jMyhX/JyOQ64ZeKQdyW+z7pFs5n7u
SC7Y3V/kNjjyHzJshV4P9nru56sfyghA90GZoA3+R6LOvWE=
=gKpy
-----END PGP MESSAGE-----";
$plain = $gpg->decrypt($encrypted_text);
var_dump($plain);
返回bool(false)
我正在使用gnupg
版本和PHP
版本
GPGme Version 1.7.1
Extension Version 1.4.0
PHP 7.0.18
知道解密失败的原因吗?