[dev] S/MIME again

Cliff Green green@UMDNJ.EDU
Fri, 27 Sep 2002 13:47:54 -0400


This message is in MIME format.

---------------------- multipart/mixed attachment
Quoting Mike Cochrane <mike@graftonhall.co.nz>:

> > ----- Message from green@UMDNJ.EDU ---------
> > Well, I haven't:
> > 1) hooked the ui to the library yet (signing is easiest, so I'll look
> >    there first)
> If you have problems with this, just email the list and i'll try sort it out.

Okay, I've got two problems I'm focussed on right now:

1) I've added (among other things) the code for opening the passphrase window
when trying to sign with s/mime, and it succeeds in opening and getting my
passphrase, but - after doing that, the blanked windowlet doesn't go away and
let the message get sent.  Killing that window and resending works fine (well,
more on that next), with the passphrase already cached.  So, how do I get rid of
that passphrase window on clicking submit?  FWIW, all I did was dupe the two
lines for open_pgp_win.js, changing 'pgp' to 'smime' where appropriate, and
wrapping both sets of "include" and "echo" lines in an if clause which checks if
the user has checked "S/MIME Sign".

2) More annoying, when putting the whole thing together (message body and
detached signature), I either a) send a MIME message that's got the primary
Content-type set to multipart/mixed, the first attachment set to the plaintext
body, and a second attachment set to the signed message (too many attachments)
OR b) just manage to send the plain message without the signature.

I successfully get back the signed message, with
$imp_smime->signMessage($body->toCanonicalString()), but somewhere in the
following code is where I'm going astray:

<---code begins--->
          /* Add the SMIME signature. */
          $smime_sign = new MIME_Part('application/x-pkcs7-signature', \
 $signed_message, null, 'attachment');
          $smime_sign->setDescription(_("S/MIME Cryptographic Signature"));

          /* Setup the multipart MIME Part. */
          $sign_part = new MIME_Part('multipart/signed');
          $sign_part->addPart($body);
          $sign_part->addPart($smime_sign);
          $sign_part->setContentTypeParameter('protocol', \
 "application/x-pkcs7-signature"');
          $sign_part->setContentTypeParameter('micalg', 'sha1');
          $mime->addPart($sign_part);
<----code ends---->

The code above, btw, sends the *properly signed* message and detached signature
wrapped in an extra, unwanted MIME envelope as described above.

This is getting frustrating, because I can sense that it's just out of reach. <g>

c
-- 
Cliff Green
Academic Computing Services - UMDNJ
Signature under NDA
---------------------- multipart/mixed attachment
Quoting Mike Cochrane <mike@graftonhall.co.nz>:

> > ----- Message from green@UMDNJ.EDU ---------
> > Well, I haven't:
> > 1) hooked the ui to the library yet (signing is easiest, so I'll look
> >    there first)
> If you have problems with this, just email the list and i'll try sort it out.

Okay, I've got two problems I'm focussed on right now:

1) I've added (among other things) the code for opening the passphrase window
when trying to sign with s/mime, and it succeeds in opening and getting my
passphrase, but - after doing that, the blanked windowlet doesn't go away and
let the message get sent.  Killing that window and resending works fine (well,
more on that next), with the passphrase already cached.  So, how do I get rid of
that passphrase window on clicking submit?  FWIW, all I did was dupe the two
lines for open_pgp_win.js, changing 'pgp' to 'smime' where appropriate, and
wrapping both sets of "include" and "echo" lines in an if clause which checks if
the user has checked "S/MIME Sign".

2) More annoying, when putting the whole thing together (message body and
detached signature), I either a) send a MIME message that's got the primary
Content-type set to multipart/mixed, the first attachment set to the plaintext
body, and a second attachment set to the signed message (too many attachments)
OR b) just manage to send the plain message without the signature.

I successfully get back the signed message, with
$imp_smime->signMessage($body->toCanonicalString()), but somewhere in the
following code is where I'm going astray:

<---code begins--->
          /* Add the SMIME signature. */
          $smime_sign = new MIME_Part('application/x-pkcs7-signature', \
 $signed_message, null, 'attachment');
          $smime_sign->setDescription(_("S/MIME Cryptographic Signature"));

          /* Setup the multipart MIME Part. */
          $sign_part = new MIME_Part('multipart/signed');
          $sign_part->addPart($body);
          $sign_part->addPart($smime_sign);
          $sign_part->setContentTypeParameter('protocol', \
 "application/x-pkcs7-signature"');
          $sign_part->setContentTypeParameter('micalg', 'sha1');
          $mime->addPart($sign_part);
<----code ends---->

The code above, btw, sends the *properly signed* message and detached signature
wrapped in an extra, unwanted MIME envelope as described above.

This is getting frustrating, because I can sense that it's just out of reach. <g>

c
-- 
Cliff Green
Academic Computing Services - UMDNJ
Signature under NDA
---------------------- multipart/mixed attachment--