Sign on Save

Hello,

Yes, please use the class SecureEmailManager
that allow to add and check signatures of MailMessage and MapiMessage objects.
For example:

var fileName =  "message.msg";
var privateCertFile = "certFile.pfx";
var privateCert = new X509Certificate2(privateCertFile, "password");

var msg = MapiMessage.Load(fileName);

var signedDetached =
    new SecureEmailManager().AttachSignature(msg, privateCert, new SignatureOptions { Detached = true });

if (signedDetached.IsSigned)
{
    Console.WriteLine("Detached Signature Attached Successfully.");
}

var signedNonDetached =
    new SecureEmailManager().AttachSignature(msg, privateCert, new SignatureOptions { Detached = false });

if (signedNonDetached.IsSigned)
{
    Console.WriteLine("Non-Detached Signature Attached Successfully.");
}
1 Like

Hello,
I tested this code to sign Emlx emails, and found that:

either it makes invalid emails

or Aspose itself cannot parse the signing certificate itself

To reproduce, please test 3 emlx files created using latest Aspose against this code:

Dim MyMailMessage As Email.MailMessage = Email.MailMessage.Load(file, loadOpt)
Dim MySmimeResult As Email.SmimeResult = New Email.SecureEmailManager().CheckSignature(MyMailMessage)
MsgBox(MySmimeResult.Error.Message)

emlx.zip (16.6 KB)

Hello,

We’ll look into it and get back to you.

@australian.dev.nerds
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILNET-41315

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

@australian.dev.nerds
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILNET-41317

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello,
What was 41345 which is marked as resolved and what’s the 41317 which is new?
I though 41315 was for emlx issue but no idea about the latter. thanks

Hello,

Please never mind that. EMAILNET-41315 has been opened to investigate the problem. The problem appeared to be more extensive, so we created a new ticket to continue the deeper investigation. So, further refer to EMAILNET-41317.
Thanks.

1 Like

Thank you very much for the valuable work.

Please be kind and advise your comment on this overload?

msg.AttachSignature( Cert As X509Certificate2 , Detached As Boolean , Hash Algorithm As String )

Hash Algorithm As String to accept SHA1 SHA256 SHA384 SHA512 … or have an Enum for signing hash algorithm…

It seems you’re asking about an alternative for the current AttachSignature methods. This approach provides flexibility, so we will consider this enhancement.

1 Like

Hello,
In 24.4 release notes: EMAILNET-41317 Provide the option to attach a signature while saving a message
Is this for the invalid emlx signing or hash algorithm overload or else?
Thanks.

Hello,

This ticket is related to invalid emlx signing.