[Tickets #3499] NEW: [SMIME Encrypted Messages] ]View Source & Save As should show/download decrypted Message

bugs@bugs.horde.org bugs at bugs.horde.org
Thu Feb 16 11:17:18 PST 2006


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=3499
-----------------------------------------------------------------------
 Ticket             | 3499
 Created By         | harakiri_23 at yahoo.com
 Summary            | [SMIME Encrypted Messages] ]View Source & Save As should show/download decrypted Message
 Queue              | IMP
 Version            | 4.1-RC2
 State              | New
 Priority           | 2. Medium
 Type               | Enhancement
 Owners             | 
-----------------------------------------------------------------------


harakiri_23 at yahoo.com (2006-02-16 11:17) wrote:

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;





More information about the bugs mailing list