6.0.0-beta1
7/26/25

[#3499] [SMIME Encrypted Messages] ]View Source & Save As should show/download decrypted Message
Summary [SMIME Encrypted Messages] ]View Source & Save As should show/download decrypted Message
Queue IMP
Queue Version 4.1-RC2
Type Enhancement
State Rejected
Priority 2. Medium
Owners
Requester harakiri_23 (at) yahoo (dot) com
Created 02/16/2006 (7100 days ago)
Due
Updated 02/20/2006 (7096 days ago)
Assigned
Resolved 02/20/2006 (7096 days ago)
Milestone
Patch No

History
02/20/2006 02:18:16 PM harakiri_23 (at) yahoo (dot) com Comment #3 Reply to this comment
what has this to do with a horde major release ? its IMPs duty to do that
02/20/2006 09:18:17 AM Michael Slusarz Comment #2
State ⇒ Rejected
Reply to this comment
No way in hell this is even remotely close to a viable solution.  MIME 
fixes are coming in the next major release of Horde.
02/16/2006 07:17:18 PM harakiri_23 (at) yahoo (dot) com Comment #1
State ⇒ New
Priority ⇒ 2. Medium
Type ⇒ Enhancement
Summary ⇒ [SMIME Encrypted Messages] ]View Source & Save As should show/download decrypted Message
Queue ⇒ IMP
Reply to this comment
Currently, when using IMP SMIME/Encrypted messages will be downloaded 
encrypted even tho they are displayed as decrypted.



This is a minor/major annoyance - because users could/have their 
private keys only stored on the IMP server and are not able to save 
the message because its still encrypted.



I've made a small hack (yes its ugly but it will work without 
troubles) to the view.php page (see below).



This works for two reasons : when the users sees the decrypted message 
- the IMP_SMIME object already has the passphrase and the secret key 
cached and you can simply call it again PRE downloading/viewing.



If this message is not an encrypted message it will throw and error 
and proceed normally. I know this is ugly but i do not have a wide 
knowledge of the IMP framework.



However - since this was - just a "2 liner" it could be easily added to IMP

i suggest a similar behaviour for PGP



Alternatly - you could add another button in the user pref bar 
"download decrypted message"



case 'view_source':

     $msg = $contents->fullMessageText();



     // BEGIN UGLY HACK

         require_once IMP_BASE . '/lib/Crypt/SMIME.php';

         $_impSmime = &new IMP_SMIME();

         $decrypted_data = $_impSmime->decryptMessage($msg);



                 if (!is_a($decrypted_data, 'PEAR_Error')) {

            $msg = $decrypted_data;

         }

     // END UGLY HACK



     $browser->downloadHeaders('Message Source', 'text/plain', true, 
strlen($msg));

     echo $msg;

     exit;



case 'save_message':

     require_once IMP_BASE . '/lib/MIME/Headers.php';

     $imp_headers = &new IMP_Headers($index);



     $name = 'saved_message';

     if (($subject = $imp_headers->getOb('subject', true))) {

         $name = trim(preg_replace('/[^\w-+_\. ]/', '_', $subject), ' _');

     }



     if (!($from = $imp_headers->getFromAddress())) {

         $from = '<>';

     }

     $date = strftime('%a %b %d %H:%M:%S %Y', $imp_headers->getOb('udate'));

     $body = 'From ' . $from . ' ' . $date . "\n" . 
$contents->fullMessageText();

     $body = str_replace("\r\n", "\n", $body);



     // BEGIN UGLY HACK

         require_once IMP_BASE . '/lib/Crypt/SMIME.php';

         $_impSmime = &new IMP_SMIME();

         $decrypted_data = $_impSmime->decryptMessage($body);



                 if (!is_a($decrypted_data, 'PEAR_Error')) {

            $body = $decrypted_data;

         }

     // END UGLY HACK



     $browser->downloadHeaders($name . '.eml', 'message/rfc822', 
false, strlen($body));

     echo $body;

     exit;


Saved Queries