[imp] Re: CVS HEAD PGP problems

Didi Rieder adrieder@sbox.tugraz.at
Sat Nov 30 18:00:15 2002


--On Friday, November 29, 2002 05:31:32 PM +0100 Didi Rieder 
<adrieder@sbox.tugraz.at> wrote:

> Hi,
>
> I'm running the cvs version of IMP from today and found the following
> problems:
>
> 1.
> When I try to encrypt a message, IMP tells me that it couldn't find the
> public-key for the reciepent, although the key exists in the addressbook.
>
> 	PGP Error: No pgpPublicKey entry found for Didi Rieder 	
> 	<adrieder@sbox.tugraz.at>.
>
> Then IMP sends the message unencrypted, but the recipient gets an empty
> message (just the headers).
>
> 2.
> When I try to encrypt and sign a message, the compose window gets empty
> (white) and on message is sent.
>

Hi, I tried to solve both problems and I'm coming with the following patch 
which seems to solve them. Please take a look at it and tell me if it is ok.
(attention to t)

Thanks
	Didi

--- PGP.php.old Sat Nov 30 18:51:50 2002
+++ PGP.php     Sat Nov 30 18:51:49 2002
@@ -630,7 +630,7 @@ class IMP_PGP extends Horde_Crypt_pgp {
         $key_addr = array_pop($addrOb);

         /* Get the public key for the address. */
-        $public_key = $this->getPublicKey($to_address);
+        $public_key = $this->getPublicKey($key_addr);
         if (is_a($public_key, 'PEAR_Error')) {
             return $public_key;
         }
@@ -683,9 +683,16 @@ class IMP_PGP extends Horde_Crypt_pgp {
      */
     function signAndEncryptMIMEPart($mime_part, $to_address)
     {
-        $encrypt_params = $this->_encryptParameters();
-        if (is_a($params, 'PEAR_Error')) return $params;
-        return parent::signAndEncryptMIMEPart($mime_part, 
$this->_signParameters(), $encrypt_params);
+        $encrypt_params = $this->_encryptParameters($to_address);
+        if (is_a($encrypt_params, 'PEAR_Error')) return $encrypt_params;
+
+       $part = parent::signMIMEPart($mime_part, $this->_signParameters());
+       $part->setContents($part->toString());
+
+       $part = parent::encryptMIMEPart($part, $encrypt_params);
+       $part->setDescription(_("PGP Signed/Encrypted Data"));
+
+       return $part;
     }

     /**


-- 
-------------------------
Didi Rieder
adrieder@sbox.tugraz.at
-------------------------



More information about the imp mailing list