SMIME is an interesting protocol that is a bit tricky to implement. Its tricky to _create_ an SMIME mail in the first place as email content changes every step through the email transition. This of course means the digest must be calculated for only a portion of the mail (the secure part). When I had to do this it meant constructing a headerless multipart MIME mail, and then using OpenSSL (iirc) to sign it.

I did a bit of research into setting up a secure email gateway once, and I reckon it would behave similarly. A mail is received by the gateway. It would remove the preexisting headers, use the sender name to lookup a certificate, sign the content, and then put the headers back on.

Incidentally we used MIME::Parser/MIME::Entity to handle the mime stuff.... And it looks like the module you refernce is just the thing to do all of this. It looks like it handles all the tricky stuff we had to hand code.

Incidentally if you do a super search for my name and SMIME I think you will find some code we wrote ages back to do our signing. (That I had permission to release) Its probably out of date and not very useful but it may be worth a quick gander. I dont remember. :-)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi



In reply to Re: Automatically signing outgoing email by demerphq
in thread Automatically signing outgoing email by mpeppler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.