A PHP project uses GnuPG in LINUX to encrypt data. However, after the project needs to be migrated to another server, the encrypted information cannot be displayed normally. The decryption code is as follows: {code ...} the gnupg PHP extension and the GnuPG under LNUX have been installed, and the Private Key read by PHP is also... a PHP project uses GnuPG in LINUX to encrypt data. However, after the project needs to be migrated to another server, the encrypted information cannot be displayed normally.
The decryption code is as follows:
$GnuPG = new gnupg();$PrivateData=file_get_contents(JPATH_SITE .DS.'.gnupg'.DS."private.gpg");$PrivateKey = $GnuPG->import($PrivateData);$GnuPG->adddecryptkey($PrivateKey['fingerprint'],GPGPASSWORD);
The gnupg PHP extension and the GnuPG under LNUX have been installed. The private key read by PHP is also confirmed to have been migrated, but the encrypted information cannot be displayed. Does the GnuPG of the new server need to be configured? Do you need to import the Public Key?
Reply content:
A PHP project uses GnuPG in LINUX to encrypt data. However, after the project needs to be migrated to another server, the encrypted information cannot be displayed normally.
The decryption code is as follows:
$GnuPG = new gnupg();$PrivateData=file_get_contents(JPATH_SITE .DS.'.gnupg'.DS."private.gpg");$PrivateKey = $GnuPG->import($PrivateData);$GnuPG->adddecryptkey($PrivateKey['fingerprint'],GPGPASSWORD);
The gnupg PHP extension and the GnuPG under LNUX have been installed. The private key read by PHP is also confirmed to have been migrated, but the encrypted information cannot be displayed. Does the GnuPG of the new server need to be configured? Do you need to import the Public Key?
Solve the problem. In PHP 5.2, gnupg can be installed before encryption and decryption can be performed normally, but it cannot be performed on PHP 5.3, which may be a version issue.