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 |
State ⇒ Rejected
fixes are coming in the next major release of Horde.
State ⇒ New
Priority ⇒ 2. Medium
Type ⇒ Enhancement
Summary ⇒ [SMIME Encrypted Messages] ]View Source & Save As should show/download decrypted Message
Queue ⇒ IMP
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;