[dev] Re: [imp] Error viewing HTML email
Cliff Green
green at UMDNJ.EDU
Sun Dec 15 05:17:37 PST 2002
(After switching this from the imp list to the dev list),
Quoting Michael M Slusarz <slusarz@bigworm.colorado.edu>:
> Quoting Cliff Green <green@UMDNJ.EDU>:
>
> | Quoting Michael M Slusarz <slusarz@bigworm.colorado.edu>:
[munch]
> | If I can fix this, do you still want just the signing portion(s)?
>
> Please. We only have partial support for S/MIME as we speak, so the sooner
> this is implemented the greater ability we have to test/debug and the
> greater the chance this will appear in a stable branch soon.
>
> michael
Okay, here are most of the related patches (more on that later).
/horde/lib/Crypt/smime.php.diff: adds support of an additional signing cert, in
case your CA is either a private hierarchy, or an intermediate CA.
/imp/compose.php.diff: adds support for S/MIME signing; now also signs
multipart/mixed messages with attachments. The _actionWindow, prompting for
one's passphrase needs work (Please!) - although the action window prompts
for and gets the user's passphrase, and gets the private key resource, the first
attempt to sign doesn't take (the message goes out unsigned), but then it works
as expected. I suspect the problem is here, and not in smime.php or compose.inc.
/imp/lib/SMIME.php.diff: adds support for an additional cert when signing.
/imp/smime.php.diff: adds an _actionWindow to prompt user for passphrase
protecting private key used for S/MIME, and (begins to) add support for
importing an additional signing cert (this doesn't work right yet)
/imp/templates/compose/compose.inc.diff: adds s/mime sign and/or encrypt
checkboxes. Encrypting does nothing yet.
/imp/templates/smime/import_key_inc.diff: tries to add UI for adding additional
signing cert (see above).
/imp/templates/smime/smime.inc.diff: more UI support for importing an additional
signing cert.
Not included in this set of patches:
-additional field in turba_objects: object_usercertificate
-addiitional field in private addressbook, in turba/config/prefs.php:
support for userCertificate/object_usercertificate
These last two are in preparation for encrypting mail to a correspondent. I
still don't have a way of importing these, and my first attempts at encrypting
didn't work. More later.
The signing code in compose.php seems like a hack due to the output from the
openssl_pkcs7_ functions (see the comments). There's a tradeoff in switching to
the non-pkcs7 openssl_ functions in PHP: added granularity of the components of
a message (i.e., you can build the MIME structure with addParts() more readily),
but you lose some of the added features (like the additional certs). The most
flexibility would come from either using an external binary or putting in more
work on the openssl_ extensions to PHP. My first stabs at the latter were
abysmal failures.
So, there's more to do.
Oh. These patches were against current CVS as of 12/15/02, between 12:30AM and
1:20 AM, Eastern Time.
I *really* wanted to sign this message <g>, but although signature verification
works again (Thank You, Michael!), rendering signed, multipart messages doesn't
yet. (But, they do render in Communicator and Mozilla, so I'm pretty sure the
code functions as intended).
c
--
Cliff Green
Academic Computing Services - UMDNJ
Signature under NDA-------------- next part --------------
--- smime.php.dist Mon Dec 9 12:45:03 2002
+++ smime.php Thu Dec 12 13:45:58 2002
@@ -254,6 +254,7 @@
* 'sigtype' => Determine the signature type to use. (Optional)
* 'cleartext' -- Make a clear text signature
* 'detach' -- Make a detached signature (DEFAULT)
+ * 'additional' => additional signing cert(s)
* </pre>
*
* @return string The signed message.
@@ -278,12 +279,19 @@
/* Create temp files for input/output. */
$input = $this->_createTempFile('horde-smime');
$output = $this->_createTempFile('horde-smime');
+ /* and for additional certificate */
+ $additional = $this->_createTempFile('horde-smime');
/* Store message in temporary file. */
$fp1 = fopen($input, 'w+');
fputs($fp1, $text);
fclose($fp1);
+ /* Store additional cert in temporary file. */
+ $fp2 = fopen($additional, 'w+');
+ fputs($fp2, $params['additional']);
+ fclose($fp2);
+
/* Determine the signature type to use. */
$flags = PKCS7_DETACHED;
if (array_key_exists('sigtype', $params) &&
@@ -291,7 +299,8 @@
$flags = PKCS7_TEXT;
}
- openssl_pkcs7_sign($input, $output, $params['pubkey'], array($params['privkey'], $params['passphrase']), array() , $flags);
+// openssl_pkcs7_sign($input, $output, $params['pubkey'], array($params['privkey'], $params['passphrase']), array() , $flags);
+ openssl_pkcs7_sign($input, $output, $params['pubkey'], array($params['privkey'], $params['passphrase']), array() , $flags, $additional);
$result = file($output);
if (empty($result)) {
-------------- next part --------------
z'µìmjÛZrܲÇ+¹¶ÞtÖ¦z)©r©¢Ç©b}ôò¥ë^Æßñq(³{Í·õ¼zÀÞ±É赫ÚVå+m§ÿåËlÝzàýªÜ+Þ³÷^¿öµ§!éí³ý´Ómv×Û×ßwj\¢jh±êa¥¸§-------------- next part --------------
A non-text attachment was scrubbed...
Name: imp_lib_SMIME.php.diff
Type: text/x-c
Size: 2144 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20021215/b198ad5d/imp_lib_SMIME.php.bin
-------------- next part --------------
--- smime.php.dist Wed Dec 4 00:21:01 2002
+++ smime.php Thu Dec 12 09:48:43 2002
@@ -56,6 +56,15 @@
require IMP_TEMPLATES . '/smime/passphrase.inc';
}
+function _actionWindow()
+{
+ $oid = Horde::getFormData('passphrase_action');
+ require_once HORDE_BASE . '/lib/Cache.php';
+ $cacheSess = &Cache::singleton('session');
+ $cacheSess->setPruneFlag($oid, true);
+ Horde::closeWindowJS($cacheSess->query($oid));
+}
+
function _reloadWindow()
{
Horde::closeWindowJS('opener.focus();opener.location.href="' . Horde::getFormData('reload') . '";');
@@ -121,6 +130,10 @@
$imp_smime->addPersonalPublicKey($publicKey);
_importKeyDialog(SMIME_PROCESS_IMPORT_PERSONAL_KEY);
}
+ exit;
+
+ case SMIME_IMPORT_ADDITIONAL_CERT:
+ _importKeyDialog(SMIME_IMPORT_ADDITIONAL_CERT);
exit;
case SMIME_PROCESS_IMPORT_PERSONAL_KEY:
-------------- next part --------------
--- compose.inc.dist Wed Dec 11 00:23:20 2002
+++ compose.inc Wed Dec 11 00:26:02 2002
@@ -467,6 +467,42 @@
<td> </td>
<?php endif; ?>
</tr>
+<!-- SMIME STUFF -->
+<?php if ($prefs->getValue('use_smime')): ?>
+ <?php if ($prefs->getValue('smime_private_key')): ?>
+ <?php if ($prefs->getValue('smime_public_key')): ?>
+ <tr>
+ <td class="item" nowrap="nowrap" align="left">
+ <b> <?php echo _("S/MIME Options")?>:</b>
+ </td>
+ <?php if ($conf['user']['online_help'] && $browser->hasFeature('javascript')): ?>
+ <td class="item" align="right"><?php echo Help::link('imp', 'smime-compose-submit') ?></td>
+ <?php else: ?>
+ <td class="item"> </td>
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="item" nowrap="nowrap" align="left">
+ <input id="ssign" type="checkbox" name="SMIME_signed" /><label for="ssign">
+ <?php echo _("S/MIME Sign your message?") ?></label>
+ </td>
+ <td class="item"> </td>
+ </tr>
+ <?php endif; ?>
+ <?php endif; ?>
+<?php endif; ?>
+
+<?php if ($prefs->getValue('use_smime')): ?>
+ <tr>
+ <td class="item" nowrap="nowrap" align="left">
+ <input id="scrypt" type="checkbox" name="SMIME_encrypted" /><label for="scrypt">
+ <?php echo _("S/MIME Encrypt your message?") ?></label>
+ </td>
+ <td class="item"> </td>
+ </tr>
+<?php endif; ?>
+<!-- SMIME STUFF -->
<?php if ($prefs->getValue('use_pgp')): ?>
<?php if ($prefs->getValue('pgp_public_key')): ?>
<tr>
@@ -654,5 +690,5 @@
<?php endif; ?>
<?php if ($prefs->getValue('auto_expand')): ?>
-<iframe id="autoexpand" name="autoexpand" style="width:0px;height:0px;border-width:0px" src="<?php echo Horde::applicationUrl('expand.php') ?>"></iframe>
+<iframe id="autoexpand" name="autoexpand" style="width:0px;height:0px;border-width:0px" src="<?php echo Horde::applicationUrl('expand.php') ?>"></iframe>
<?php endif; ?>
-------------- next part --------------
--- import_key.inc.dist Wed Dec 11 16:46:12 2002
+++ import_key.inc Wed Dec 11 16:48:09 2002
@@ -10,6 +10,8 @@
<td align="left" class="header" nowrap="nowrap"><b><?php echo _("Import Personal Public S/MIME Key") ?></b></td>
<?php elseif ($actionID == SMIME_IMPORT_PERSONAL_PRIVATE_KEY): ?>
<td align="left" class="header" nowrap="nowrap"><b><?php echo _("Import Personal Private S/MIME Key") ?></b></td>
+<?php elseif ($actionID == SMIME_IMPORT_ADDITIONAL_CERT): ?>
+<td align="left" class="header" nowrap="nowrap"><b><?php echo _("Import Additional (signing) Certificate") ?></b></td>
<?php endif; ?>
</tr>
</table>
-------------- next part --------------
--- smime.inc.dist Wed Dec 11 16:35:45 2002
+++ smime.inc Thu Dec 12 12:26:15 2002
@@ -49,7 +49,7 @@
</table>
</td>
</tr>
-<?php elseif ($prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key')): ?>
+<?php elseif ($prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key') && $prefs->getValue('smime_additional_cert')): ?>
<?php
$unload_url = Horde::addParameter($selfURL, 'smimeActionID=' . SMIME_UNSET_PASSPHRASE);
?>
@@ -63,6 +63,10 @@
<tr>
<td class="item" align="left"><b> <?php echo _("Your Private Key") ?>:</b></td>
<td class="item" align="left"> [<?php echo (empty($passphrase)) ? Horde::link('', _("Enter Passphrase"), null, null, $opensmimewin . ' return false;') . _("Enter Passphrase") : Horde::link($unload_url, _("Unload Passphrase")) . _("Unload Passphrase") ?></a>]</td>
+ </tr>
+ <tr nowrap="nowrap">
+ <td class="item" align="left"><b> <?php echo _("any Additional Signing Certificate") ?>:</b></td>
+ <td class="item" align="left"></td>
</tr>
</table>
</td>
More information about the dev
mailing list