From: ("marcello")
Date:  29 Jul 2016 19:15:19 Hong Kong Time

[PEAR-BUG] Bug #20555 [Com]: Mail_mimeDecode improperly handles S/MIME Encrypted messages

NNTP-Posting-Host:  null

Edit report at

 ID:               20555
 Comment by:       marcello
 Reported By:      marcello dot ceschia at gmail dot com
 Summary:          Mail_mimeDecode improperly handles S/MIME Encrypted
 Status:           Feedback
 Type:             Bug
 Package:          Mail_mimeDecode
 Operating System: FreeBSD 10.1-STABLE
 Package Version:  1.5.5
 PHP Version:      5.5.25
 New Comment:

I did some debug to get z-push working with S/MIME messages and provided
a solution for that, see
I'm not totaly sure if this complies to RFC1341 but it is working with
BlackBerry HUB and android nine client

Previous Comments:

[2015-06-03 06:33:55] alan_k

-Status: Open +Status: Feedback
Can you work out a patch for this? ------------------------------------------------------------------------ [2015-06-02 16:16:51] tickerguy Description: ------------ When passed an S/MIME encrypted message, which specifies the MIME component as an attachment, the package fails to return the base64 component (which is found in the message body without a delimiter, as there is no other component) as an attachment. It instead returns it in the message body component despite the fact that the disposition is declared as an attachment. This causes synchronization software that relies on the proper behavior (e.g. Z-push) to push an incorrect email package to the mobile device, which is unable to decode it as the expected attachment is missing. Note that PGP-encrypted messages fail in the same fashion for the same reason. Test script: --------------- Send a S/MIME encrypted email to yourself. Note (by inspection of the mail spool) that the following is in the Content headers: Content-Type: application/pkcs7-mime; name="smime.p7m"; smime-type=enveloped-data Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7m" Content-Description: S/MIME Encrypted Message Note that when mimeDecode processes the mail there are no attachments returned and the base64 component, which (if you specified) is decoded to binary, is returned in the body structure instead. Attached file is a test message that can be passed through this routine to reproduce the bug. Expected result: ---------------- The body should be an empty string and there should be one attachment returned containing the encrypted data. Actual result: -------------- The message body contains the base64 data and the attachment list/array has no elements. ------------------------------------------------------------------------ -- Edit this bug report at