I've a certificate and wanted to use it to encrypt the MailMessage for creating a smime message.
Certificate recipient = Certificate.LoadPfx(certificateKey, certificatePassword);
var message = new MailMessage();
string[] enhancedUsageOids = recipient.GetEnhancedUsage();
message.Attachments.Add(new Attachment(encryptFilePath));
message.Encrypt( recipient);
However, the enhancedUsageOids = "1.3.6.1.5.5.7.3.1" and so when I use message.Encrypt I got the same error "No recipient has a certificate with correct key usage for encryption".
I can create a smime message with EnvelopedCms (.net framework), encrypted using upper certificate.
My question is can I archived the same thing with Rebex ? Cause when using EnvelopedCMS to generate the smime message, I have to use Reflection for getting the message.
Thanks