0 votes

How can we use Pkcs#11 provider like smart card and HSM (hardware security module) for singing and creating smime mail.
we have users that are using smart cards for signing their sendign mails as smime mail.

by

1 Answer

0 votes

Mail.dll does not directly support card readers.

To encrypt/decrypt/sign/verify SMIME emails you'll need standard .NET X509Certifcate2 class instance.

So the question is how to get those from the reader?

I think that certificates should be available through the Windows Certificate Store:

X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
foreach (X509Certificate2 certificate in store.Certificates)
{
    Console.WriteLine(certificate.IssuerName);
    Console.WriteLine(certificate.SubjectName);
    //...
}
by (301k points)
...