I recently had a case where a customer wanted to know how to create S/MIME messages.  We have an existing KB that demonstrates how to send S/MIME messages using CDO for Windows 2000 (CDOSYS) and CAPICOM.  However, he wanted a pure .NET based solution.

Unfortunately, a pure .NET solution is not possible without writing a MIME Writer and your own SMTP client.  The reason is that in order to create a S/MIME message you need to be able to access the entire MIME skeleton.  In constructing the email message you may need to sign and/or encrypt parts or the whole MIME stream.  The existing email classes in the .NET Framework don't provide this level of MIME part access.  As such, although you can use the cryptography classes to replace CAPICOM, you cannot replace CDO for Windows 2000.

I plan to either create a new KB or a sample that demonstrates how to replace the CAPICOM implementation in the KB with the cryptography classes in .NET.  I will update this blog post once the KB is produced.