API Reference documentation of S/MIME support


#1

I was looking for S/MIME support and although I can’t see it mentioned anywhere (I mean in the list of features etc.), I found posts in this forum saying that the support is there and there are methods like Encrypt, Decrypt, AttachSignature and RemoveSignature. I even found an example that does encryption: https://github.com/aspose-email/Aspose.Email-for-.NET/blob/master/Examples/CSharp/Email/EncryptAndDecryptMessage.cs
However, I see no mention of these methods in the actual API Reference: https://apireference.aspose.com/net/email/aspose.email/mailmessage
Should I assume the API Reference is simply incomplete, or am I missing something?
Thanks, Vaclav


#2

@vashek,

I have observed your requirements and like to inform that API reference guide is generated using automation tools and what even is available in API is specified in API reference guide. Can you please share what is issue incurring on your end.


#3

I have no issue yet, I was simply looking for information how to implement support for S/MIME messages. So, is the Decrypt method supported or not?


#4

@vashek,

Can you please elaborate your requirements that what you want to achieve using Aspose.Email. What you actually mean and where you mean to use Encrypt or Decrypt using Aspose.Email API. A working example and sample files would really be helpful to understand your requirements.


#5

I am just asking a simple, straightforward question: is there a Decrypt method on Aspose.Email.MailMessage? If yes, why is in not documented? If not, why is it used in examples or why is it gone?
I don’t yet have any source code to demonstrate any problem, I am simply trying to understand the API before I even start coding anything.


#6

@vashek,

I suggest you to please consider following sample code on your end.

    string fileName = Path.Combine(testPath, "test2.eml");
        string publicCertFile = Path.Combine(testPath, "public_cert.cer");
        string privateCertFile = Path.Combine(testPath, "private_cert.pfx");
        X509Certificate2 publicCert = new X509Certificate2(publicCertFile);
        X509Certificate2 privateCert = new X509Certificate2(privateCertFile, "123456");

        MailMessage msg = MailMessage.Load(fileName);

        MailMessage eMsg = sMsg.Encrypt(publicCert);

        MailMessage dMsg = eMsg.Decrypt(privateCert);
		dMsg.Save(fileName + ".dec.eml);

you may use:

MailMessage dMsg = eMsg.Decrypt();
dMsg.Save(fileName + ".dec.eml);

If you use Decrypt method without parameters than private certificate will be taken from certificate stores on you machine(if exists) otherwise exception will be thrown.