简体   繁体   English

在PHP中使用PGP加密文件,GnuPG版本意外

[英]Encrypting files using PGP in PHP, GnuPG version unexpected

I am using gnupg in php to encrypt content. 我在php中使用gnupg加密内容。

In a dev environment, encrypted messages begin with: 在开发环境中,加密的消息以:

-----BEGIN PGP MESSAGE----- Version: GnuPG v2.0.22 (GNU/Linux) ----- BEGIN PGP消息-----版本:GnuPG v2.0.22(GNU / Linux)

For the production environment, encrypted messages begin with: 对于生产环境,加密消息以以下内容开头:

-----BEGIN PGP MESSAGE----- Version: GnuPG v1 ----- BEGIN PGP消息-----版本:GnuPG v1

I am at a loss as to why the files are being encrypted differently. 我不知道为什么文件采用不同的加密方式。 Both are valid encryptions, but they decrypt differently (per the recipient, the "GnuPG v2.0.22 (GNU/Linux)" version keeps the file name on decrypt while the other one does not, which is causing an issue on their end). 两者都是有效的加密,但是它们以不同的方式进行解密(对于接收者,“ GnuPG v2.0.22(GNU / Linux)”版本将文件名保留在解密中,而另一个则没有),这最终导致了问题。

The following appear to be the same between dev and prod: gpg.conf file, php version, pear version, gpg version, CentOS - version. 在dev和prod之间,以下内容似乎是相同的:gpg.conf文件,php版本,pear版本,gpg版本,CentOS-版本。 For the keys, I copied over the .gpg directory from dev to prod (permissioning is the same). 对于密钥,我将.gpg目录从dev复制到了prod(权限是相同的)。

How can I get the prod server to use v2.0.22 of GnuPG on the encryption? 如何使产品服务器在加密时使用GnuPG v2.0.22?

THANK YOU! 谢谢!

Copied over /usr/lib64/php/modules/gnupg.so from the dev machine and this worked in prod as expected. 从开发机上通过/usr/lib64/php/modules/gnupg.so复制,并且此方法可以按预期在prod中工作。 Per the SA, there was a compilation issue due to permissions. 根据SA,由于权限问题,存在编译问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM