0 votes

I am using the MailBuilder and have a problem when i try to create the IMail with:

IMail email = builder.Create();

On 2/3 Pcs its working fine but not on the last one. I get a System.Security Error when it comes to the creation. The certificates for signing and encrypting of the mail are placed in a shared folder in the network.
I am using:

builder.From.Add(new MailBox(SENDER));
builder.SignWith(new X509Certificate2(SignPATH, PASSWORD));

builder.To.Add(new MailBox(RECIPANT));
builder.EncryptWith(new X509Certificate2(EncPATH));

Now the problem is the creation of the mail. Any ideas what can be wrong?
Because the code is running correctly on dev machine and another pc i hope its not a heavy code problem. What else can cause windows errors in this context?

Thanks for any help.

Edit:
OS = Windows 7
Error is not specified. Only shows "Module : System.Security"

by
edited
What is the error message?
What OS is this? Is it up to date?
OS = Windows 7 (like the other 2 pcs)
Error is not specified. Only shows "Module : System.Security"
Where does it show that? Is it an exception? What is the stack trace?
Is it possible the OS is not up to date? Or configured in a different way?
It says something of an certification chain error (only have the german error message). It can not find a trusted root certification station.

   at System.Security.Cryptography.Pkcs.PkcsUtils.CreateBagOfCertificates(CmsSigner signer)
   at System.Security.Cryptography.Pkcs.SignedCms.Sign(CmsSigner signer, Boolean silent)
   at System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature(CmsSigner signer, Boolean silent)
   at Limilabs.Mail.MIME.MimeSigned.(SignatureConfiguration )
   at Limilabs.Mail.MIME.MimeSigned.(SignatureConfiguration )
   at Limilabs.Mail.MIME.MimeFactory.CreateMimeSigned(MimeBase root, SignatureConfiguration configuration)
   at Limilabs.Mail.MailBuilder.()
   at Limilabs.Mail.MailBuilder.Create()

1 Answer

+1 vote
 
Best answer

By default Mail.dll uses SignatureConfiguration.IncludeOption set to X509IncludeOption.WholeChain it seems that somehow this is a problem on this one particular machine.

I assume you are not using self signed certificates: you must put the complete chain and the root CA certificate in the trusted certificate store.

I think you should compare stores on both machines.

by (297k points)
selected by
Some of the Intermediate Certification Authorities where missing. Fixed this and fixed the problem. Thanks a lot.
...