Linux-PHPGnuPG migration

Source: Internet
Author: User
Tags gnupg
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.