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

Request #13808 Support multiple recipients
Submitted: 2008-04-30 16:02 UTC
From: gauthierm Assigned: gauthierm
Status: Closed Package: Crypt_GPG (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 28 - 3 = ?

 [2008-04-30 16:02 UTC] gauthierm (Michael Gauthier)
Description: ------------ Will likely require some major API changes but it is a feature that has been requested by users.


 [2008-06-09 09:48 UTC] matej (Matej Posinković)
Modified encrypt function (in php.php), so the message can be encrypted for multiple recipients. Function differs (compared to the function version 0.6.0) in $key_id. $key_id can now be passed as a string or an array os strings: public function encrypt($key_id, $data, $armor = true) { $data = (string)$data; $encrypted_data = null; if(is_array($key_id)) { $args = array(); foreach ($key_id as $this_key_id) { $args[] = '--recipient ' . escapeshellarg($this_key_id); } } else $args = array('--recipient ' . escapeshellarg($key_id)); if ($armor) { $args[] = '--armor'; } $args[] = '--encrypt'; $this->_openSubprocess($args); fwrite($this->_pipes[self::FD_INPUT], $data); $this->_closePipe(self::FD_INPUT); $encrypted_data = ''; while (!feof($this->_pipes[self::FD_OUTPUT])) { $encrypted_data .= fread($this->_pipes[self::FD_OUTPUT], 1024); } $code = $this->_closeSubprocess(); if ($code !== null) { switch ($code) { case Crypt_GPG::ERROR_KEY_NOT_FOUND: return new Crypt_GPG_KeyNotFoundException( "Data could not be encrypted because key '" . $key_id . "' was not found.", $code, $key_id); break; default: return new Crypt_GPG_Exception( 'Unknown error encrypting data.', $code); } } return $encrypted_data; }
 [2008-06-09 19:52 UTC] gauthierm (Michael Gauthier)
Matej, Thanks for the patch. I'm currently working on a somewhat different approach where you specify encrypt keys with an addEncryptKey() method and then call encrypt() without specifying keys. This is the approach taken by gpgme ( and also works well for signing and decrypting with more than one key.
 [2008-09-17 04:26 UTC] gauthierm (Michael Gauthier)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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. Multiple encryption recipients, decryption keys and signing keys are now supported in CVS. New API is: * addEncryptKey($key) * addDecryptKey($key, $passphrase = null) * addSignKey($key, $passphrase = null) * clearEncryptKeys() * clearDecryptKeys() * clearSignKeys() Expect a new release soon!
 [2008-09-24 17:45 UTC] gauthierm (Michael Gauthier)
This new feature is now in the latest release.