Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.9

Bug #15906 Old versions of GnuPG don't work
Submitted: 2009-02-17 14:48 UTC
From: reevery Assigned: gauthierm
Status: Closed Package: Crypt_GPG
PHP Version: 5.2.8 OS: unknown unix
Roadmaps: (Not assigned)    
Subscription  


 [2009-02-17 14:48 UTC] reevery (Matthew Reeve)
Description: ------------ Trying to create a script to encode some text via GPG (subsequently to email), Test script: --------------- $to = 'm.c.reeve@bham.ac.uk'; $subject = "[bhamf.org] Donation"; $headers = "From: bhamf.org mailer <updateform@bhamf.org>"; $message = "Encrypt this message"; require_once 'Crypt/GPG.php'; $gpg = new Crypt_GPG(array('homedir' => '/home/bhamf/private/.gnupg', 'debug' => true)); $gpg->addEncryptKey('$to'); $encrypted_message = $gpg->encrypt($to, $message); print $encrypted_message; Expected result: ---------------- Hoping to see some encoded text Actual result: -------------- https://www.bhamf.org/giving/gpg/encrypt.php

Comments

 [2009-02-17 18:46 UTC] gauthierm (Michael Gauthier)
Hi Matthew, Can you post the results of gpg --version?
 [2009-02-17 19:51 UTC] reevery (Matthew Reeve)
1.0.6 - I don't have control over this but I will ask for it to be updated.
 [2009-02-17 19:53 UTC] reevery (Matthew Reeve)
Server Admins say: "The version of GnuPG is 1.4.6."
 [2009-02-17 20:17 UTC] gauthierm (Michael Gauthier)
Thanks! From the debug output you've linked to in this report, it looks like your version of GnuPG doesn't have the --no-agent option, and this is what's causing the unknown error. Given the appropriate GnuPG version, I can test Crypt_GPG against it and fix the problem. I've only ever tested with 1.4.x version. I'll grab a copy of 1.0.6 and fix this when I get a chance. In the meantime, using version 1.4.x will probably fix the problem.
 [2009-02-18 18:44 UTC] gauthierm (Michael Gauthier)
-Summary: Uknown error getting keys +Summary: Old versions of GnuPG don't work
 [2009-02-18 18:44 UTC] gauthierm (Michael Gauthier)
-Assigned To: +Assigned To: gauthierm
 [2009-12-22 23:02 UTC] cfallen (al len)
> $gpg->addEncryptKey('$to'); the TO variable is not interpolated inside single quotes. That means GPG never receives the correct email address with which to fetch the correct keys. That may be why your script fails.
 [2010-03-01 11:02 UTC] gauthierm (Michael Gauthier)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. This is fixed as well as it can be. Old versions will no longer throw an exception all the time. You can now get the version of GnuPG with $gpg->getVersion(). The current version status is: * GnuPG version 1.0.2 can not be used at all since it lacks the command-fd. * GnuPG version 1.0.6 import-key and delete-private-key methods don't work. Encryption algorithms have different names so interoperability with current versions is poor. * GnuPG version 1.2.0 works perfectly except for import-keys. For this method, the status codes returned by GnuPG are different between version 1.2.x and 1.4.x