PGP encrypted MSG to MIME corrupted conversion


PGP encrypted MSG are corrupted when converted into MIME messages (please note this has nothing to do with decrypting PGP messages, which I know is not a feature of the Aspose.Email API).

Thunderbird can fix those PGP corrupted messages, and therefore we can see the reason of the issue when comparing both EML contents, before and after the fixing process:

  • First, for some reason the Aspose conversion process adds the following extra MimePart to the message:
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

My guess is that this relates to the message empty body (PGP message have an empty body, since the latter is encrypted into an .asc attachment”). The conversion process seems to “need” to add an empty body MimePart information, which is not necessary (see Thunderbird fixed EML example).

  • Secondly, the message headers contain a “Content-Type” information which is modified after the conversion, from:
Content-Type: multipart/encrypted;


Content-Type: multipart/mixed;

Please note this “Content-type” is not a MimePart information, it is contained in the PGP message headers.

As you can see the “multipart/encrypted” information is changed, and the “application/pgp-encrypted” information is dismissed, simply replaced by “multipart/mixed” after the conversion.

At first, deleting the unwanted MimePart (which is a MailMessage AlternateView), and modifying the MailMessage.Header[“Content-Type”] value, should be an easy way to fix the issue.

Unfortunately no modification on the PGP MailMessage will have an effect, since everything is undone after using the MailMessage.Save(path, Aspose.Email.SaveOptions.DefaultEml) or MboxrdStorageWriter writer.WriteMessage(msgMimeParser) methods.

Currently, there is no other solution than opening EML or MBOX files by-hand using a StreamWriter, in order to fix PGP converted messages, which of course is not a viable solution.

In fact, before saving the MailMessage, the “Content-Type” header value is even correct, only the additional MimePart is present.

Please note I consider this as a critical issue, since an email converter should be able to convert any type of email, independently from the fact that they are encrypted or not.

Please find attached a zip containing: a PST with the original PGP MSG, one “corrupted” converted EML, one Thunderbird “fixed” PGP EML, a comparison of both EML contents (there is no need for a PGP private key, since this concerns messages that remain encrypted after the conversion).

Regards. (298,6 Ko)

We have opened the following new ticket in our internal issue tracking system.