v9.5.0.37 Micro Update: Mime.LoadMimeBytes Updated to Handle Mixture of bare-LF and CRLF Line Endingss

It was found that in some cases, OpenSSL may produce MIME with a mixture of both bare-LF line-endings and CRLF line-endings. MIME documents *should* always use CRLF line endings. The mixing of both line-ending types in a single MIME document caused the LoadMimeBytes method to skip past the end of the top-level header (terminated by a double bare-LF) and instead find the end of the 2nd header, which was properly terminated by a double CRLF.

Chilkat supports CAdES-BES and CAdES-EPES digital signatures

Chilkat v9.3.0, being released this week, now supports the ability to create CAdES-BES and CAdES-EPES digital signatures via the MailMan, Mime, and Crypt2 objects.   All three objects/classes now include the following new properties:

bool CadesEnabled;
string CadesSigPolicyId;
string CadesSigPolicyUri;
string CadesSigPolicyHash;  (base64 encoded representation of hash)

To create a CAdES-BES signature, simply set the CadesEnabled property = true.

For CAdES-EPES, set each of the other new properties.  For example:

crypt.CadesSigPolicyId = “”;
crypt.CadesSigPolicyUri = “http://politicas.icpbrasil.gov.br/PA_AD_RB.der”;
crypt.CadesSigPolicyHash = “rySugyKaMhiMR8Y/o5yuU2A2bF0=”;

If you set these properties prior to calling any method that creates a signature, then a CAdES signature is created.

Access MIME Parts from HTTP Request?

Is it possible to “grab“ mime parts directly from incoming HTTP request with Chilkat.Mime object? LoadMimeFile() works like a charm.

Yes, if you are using a ChilkatDotNet2.dll that is more than a few weeks old (from the date of this post), download the latest from http://www.chilkatsoft.com/preRelease/ChilkatDotNet2.zip

The latest build has a new feature built into the LoadMime and LoadMimeBinary methods that allow you to pass a “headless” MIME string. What I mean by “headless” is a MIME document that is missing the initial header, which is typically what you have in the raw HTTP request. The LoadMime and LoadMimeBinary methods will recognize that the header is missing and they will automatically parse the boundary string and re-create a basic multipart/mixed header so that the individual parts may be accessed.

Convert MIME to Plain-Text?


Is it possible to convert MIME to plain-text?


The Chilkat MIME and/or Email API’s may be used to extract the plain-text body (or bodies) and/or HTML bodies from a MIME message. If a MIME-part is already plain-text, no conversion is necessary. It’s simply a matter of using the Chilkat MIME or Email API to extract the part’s contents. If the MIME-part is HTML, the Chilkat HTML-to-Text class/component may be used to convert the HTML to plain-text.

The following C# code extracts the HTML body from this MIME message and converts the HTML to plain-text:


"MIME-Version: 1.0
Date: Wed, 23 Apr 2008 08:43:32 +0200
Message-ID: <CHILKAT-MID-848a7564-2f78-be1f-524c-5f7d96855306@shadow>
X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
X-Priority: 3 (Normal)
Content-Type: multipart/alternative;

This is a multi-part message in MIME format.

Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Content-Transfer-Encoding: quoted-printable
Content-Type: text/html

<html><head><META http-equiv=3D"Content-Type" content=3D"text/html;chars=
et=3Dutf-8"></head><body><b><span  style=3D'font-size:11pt;font-family:A=
rial'><font color=3D#000000>Problembeschreibung:<br>... <br></body></html>

C# Code:

        private void MimeToText()
            Chilkat.Email email = new Chilkat.Email();

            // Load a MIME document, which happens to be an email
            // with an HTML body (in this case).
            bool success = email.LoadEml("MimeToConvert.txt");
            if (!success)
                textBox1.Text = email.LastErrorText;

            Chilkat.HtmlToText h2t = new Chilkat.HtmlToText();

            success = h2t.UnlockComponent("Anything for 30-dayt trial");
            if (!success)
                textBox1.Text = h2t.LastErrorText;

            // Get the email's HTML body:
            string html = email.GetHtmlBody();

            // Convert to plain-text:
            string plainText = h2t.ToText(html);

            textBox1.Text = plainText;