Support » Plugin: WP PGP Encrypted Emails » Accept also S/MIME keys

  • Resolved Linmp

    (@linmp)


    It would be nice to be able to use the same RSA/ECC keys used in e-mail S/MIME.

    I know this is called WP PGP Encrypted Emails, but since anyone can create their own RSA/ ECC using a free tool like https://sourceforge.net/projects/xca/ or any other ( like maybe this one: http://sectools.free.fr/index-EN.htm ) this would be nice… and has the additional advantage of not needing any third party tool besides the e-mail software it self.

    And because the person can make their own key is as secure as it is using GnuPG.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Meitar

    (@meitar)

    Hmm, yes, being able to use S/MIME would be nice, too, but I don’t know of an existing library I can use to do this. I’ll mark this is as an enhancement suggestion on the GitHub project. Thanks, though.

    Thanks for accepting the suggestion as valid.

    I’m not a programmer, so I don’t know if this may help you achieve the objective or not:
    https://wordpress.org/plugins/smime/ some S/MIME plugin, maybe you can inspire in the code.

    http://php.net/manual/en/function.openssl-pkcs7-encrypt.php , http://php.net/manual/en/function.openssl-pkcs7-sign.php and http://php.net/manual/en/openssl.ciphers.php PHP itself supports S/MIME including advanced encryption.

    I hope at least one of this may help you, if not, at least I tried =)

    Plugin Author Meitar

    (@meitar)

    🙂 Thanks for those links.

    You’re welcome. I hope they are useful. If not, at least I tried =)

    Plugin Author Meitar

    (@meitar)

    Just a brief update to let you know someone has generously volunteered to take this on.

    That is a great news! Thanks to the user willhowells at github for the work.
    I hope that eventually you can integrate the code into the plugin after all quality assurance.

    Plugin Author Meitar

    (@meitar)

    @linmp I’ve successfully integrated @willhowells‘s work into a development version with support for sending encrypted S/MIME messages. Would you be so kind as to help us test this? I would like it to undergo at least some testing by the people who would use the feature before I release it. (I have almost never used S/MIME before so am not nearly as familiar with it as I am with GnuPG.) If you can help test, please let me know either here or, even better, on the GitHub issue tracking S/MIME support for this project. Thanks!

    Plugin Author Meitar

    (@meitar)

    @linmp Initial S/MIME support has been implemented and released in version 0.6.0, available now. Please give this a try and let me know how it works for you! 🙂

    Linmp

    (@linmp)

    Hi Meitar!
    Thanks to willhowells and you Meitar for adding the support for S/MIME in the 0.6.0 version!

    I will test the S/MIME feature in the most recent version 0.6.1 at this time, and I will give the feedback on it soon, about errors or things that can be improved if any.

    I have just tested S/MIME (for now) to send a form from web site to the admin e-mail and I find my first problem:

    I’ve tested the 0.6.2 and is not working properly for me when I received the messages encrypted to the admin from a contact form.

    I have found why it didn’t properly decrypts in the e-mail software, your software is sending the e-mail with the following before the encrypted content:

    ============= BEGIN =============
    X-WPCF7-Content-Type: text/plain
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8

    MIME-Version: 1.0
    Content-Disposition: attachment; filename=”smime.p7m”
    Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name=”smime.p7m”
    Content-Transfer-Encoding: base64
    ============= END =============

    I have change this to:

    ============= BEGIN =============
    X-WPCF7-Content-Type: text/plain
    MIME-Version: 1.0
    Content-Disposition: attachment; filename=”smime.p7m”
    Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name=”smime.p7m”
    Content-Transfer-Encoding: base64
    ============= END =============

    And the message was properly open.

    The problem is with the string:

    Content-Type: text/plain; charset=UTF-8

    If it is removed from there, the message opens properly.
    I will continue testing after this is corrected.

    Plugin Author Meitar

    (@meitar)

    Thanks for testing this. Can you please post the full source of the email (both original and corrected) so I can see a complete example? Thanks. 🙂

    Yes, first the sample that is send that doesn’t work:

    ======================== SAMPLE-NOT-WORKING.eml : BEGINNING ========================

    Return-Path: <website@example.com>
    X-Original-To: website@example.com
    Delivered-To: website@example.com
    From: Carla Ariana <website@example.com>
    To: website@example.com
    Subject: Blogmania “Acerca daquilo”
    Date: Fri, 26 May 2017 15:08:33 +0000
    Reply-To: carla.ariana@governo.gov.pt
    X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
    X-WPCF7-Content-Type: text/plain
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8

    MIME-Version: 1.0
    Content-Disposition: attachment; filename=”smime.p7m”
    Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name=”smime.p7m”
    Content-Transfer-Encoding: base64

    MIIEGAYJKoZIhvcNAQcDoIIECTCCBAUCAQAxggLMMIICyAIBADCBrzCBoTELMAkG
    A1UEBhMCUFQxFzAVBgNVBAoTDkdydXBvcHR3ZWIuY29tMR4wHAYDVQQLExVHcnVw
    b3B0d2ViLmNvbSBTU0wgQ0ExHjAcBgNVBAMTFUdydXBvcHR3ZWIuY29tIFNTTCBD
    QTE5MDcGA1UEDRMwaHR0cDovL2NhLmdydXBvcHR3ZWIuY29tLyBmb3IgbW9yZSBp
    bmZvcm1hdGlvbnMuAgkAmyOqztYz9YcwDQYJKoZIhvcNAQEBBQAEggIA33/pVGUv
    wLgUo3GkICaPYdEoqZyYXWmqhzmCHbNT++RAPTotiGT9x0FC6VPys7Cj3/98L0WI
    qbjy8e1oQkc5xy1ITKe+AagVmxogZBPZehsraBQQkHNOw9rm0u+HtNRCzqzAJ5fR
    ywO4bfohyHF6wYvt0Z8QQUwRuzDLZAzlLobBRTSSu8RJVMdLIIjwJPDPQHNcDxs8
    ouVak8hYPW39BEdig5+EelHZjYGcClUVdka/a/4Y2EgsPo9iIHF6q/ZiXJX0N0H6
    MSLD5zrZM/LCLxKUkuCcLcyAIXF5BAlMYCLdp0nVL+N+EdiVYlT4w5rkwEgSxNMS
    RJJNF+SfT1h0hy284Ku5NhJyU+vemHwuI5cP+fayrh46qDxXO02w8ZwgXT5mzZsW
    ACZ/oXxdKYzsNd3M7O03JBWie7ngGg7/07DpvXaoxXxPVxkdCtRQHN+BRMnIZAyD
    RBfbM5Tb2bU5wuy35tFzTjXEsEHdRqAp8mSe67awuFKqiUccOYEvkaBFrQXuh4gG
    qQhUEDVfRQ4hWWIqUQlEzJA5WyodLn5G+O10GNj0XacX9f4YUE4MJIv5lk++JqDA
    v8B1RiqZq6vs4nEnRwjAd8ZYC6d6jImnNyBBp8MPywGHm9E38wa79Cmsqezy1waA
    KEBf7mTtom1VbShnDRh6GghferBIRvHjsG8wggEuBgkqhkiG9w0BBwEwHQYJYIZI
    AWUDBAEqBBBotMVoZ8Qc7RAJvKRh7FUvgIIBADU92myVnerIR3iszmqLmao8ePr6
    GT56nNEU0oNVvic0dfPfveQYBaI8wL58loks3vj2ybSZmziU1mJ0aGV7+klr5fog
    PR0ChyCYYOKUSkNzxWdEizet/viGNOWs/91Q0997yy1ctxNrZDFpPRZae99h6BVy
    k8PKWTeqES8Obsmo4FTu/CgW3chRxoMQ7zp85WnDj716C4a9iQv9WL5HTCsBqRIa
    frz9V+eHegAS0EG6k6cI0w6wRKMLQQJ1YNvDuFbvg53VL1I7RF+79916PM+Mi9vy
    D/9NiJBHZAGUllQWsrC1hDVxmt0bAnofQ65DfNjpS+mpWzA3LOXSary45UU=

    ======================== SAMPLE-NOT-WORKING.eml : END ========================

    Based on the sample above send to me I did the change bellow that makes it work on the e-mail program:

    ======================== SAMPLE-WORKING.eml : BEGINNING ========================

    Return-Path: <website@example.com>
    X-Original-To: website@example.com
    Delivered-To: website@example.com
    From: Carla Ariana <website@example.com>
    To: website@example.com
    Subject: Blogmania “Acerca daquilo”
    Date: Fri, 26 May 2017 15:08:33 +0000
    Reply-To: carla.ariana@governo.gov.pt
    X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
    X-WPCF7-Content-Type: text/plain
    MIME-Version: 1.0
    Content-Disposition: attachment; filename=”smime.p7m”
    Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name=”smime.p7m”
    Content-Transfer-Encoding: base64

    MIIEGAYJKoZIhvcNAQcDoIIECTCCBAUCAQAxggLMMIICyAIBADCBrzCBoTELMAkG
    A1UEBhMCUFQxFzAVBgNVBAoTDkdydXBvcHR3ZWIuY29tMR4wHAYDVQQLExVHcnVw
    b3B0d2ViLmNvbSBTU0wgQ0ExHjAcBgNVBAMTFUdydXBvcHR3ZWIuY29tIFNTTCBD
    QTE5MDcGA1UEDRMwaHR0cDovL2NhLmdydXBvcHR3ZWIuY29tLyBmb3IgbW9yZSBp
    bmZvcm1hdGlvbnMuAgkAmyOqztYz9YcwDQYJKoZIhvcNAQEBBQAEggIA33/pVGUv
    wLgUo3GkICaPYdEoqZyYXWmqhzmCHbNT++RAPTotiGT9x0FC6VPys7Cj3/98L0WI
    qbjy8e1oQkc5xy1ITKe+AagVmxogZBPZehsraBQQkHNOw9rm0u+HtNRCzqzAJ5fR
    ywO4bfohyHF6wYvt0Z8QQUwRuzDLZAzlLobBRTSSu8RJVMdLIIjwJPDPQHNcDxs8
    ouVak8hYPW39BEdig5+EelHZjYGcClUVdka/a/4Y2EgsPo9iIHF6q/ZiXJX0N0H6
    MSLD5zrZM/LCLxKUkuCcLcyAIXF5BAlMYCLdp0nVL+N+EdiVYlT4w5rkwEgSxNMS
    RJJNF+SfT1h0hy284Ku5NhJyU+vemHwuI5cP+fayrh46qDxXO02w8ZwgXT5mzZsW
    ACZ/oXxdKYzsNd3M7O03JBWie7ngGg7/07DpvXaoxXxPVxkdCtRQHN+BRMnIZAyD
    RBfbM5Tb2bU5wuy35tFzTjXEsEHdRqAp8mSe67awuFKqiUccOYEvkaBFrQXuh4gG
    qQhUEDVfRQ4hWWIqUQlEzJA5WyodLn5G+O10GNj0XacX9f4YUE4MJIv5lk++JqDA
    v8B1RiqZq6vs4nEnRwjAd8ZYC6d6jImnNyBBp8MPywGHm9E38wa79Cmsqezy1waA
    KEBf7mTtom1VbShnDRh6GghferBIRvHjsG8wggEuBgkqhkiG9w0BBwEwHQYJYIZI
    AWUDBAEqBBBotMVoZ8Qc7RAJvKRh7FUvgIIBADU92myVnerIR3iszmqLmao8ePr6
    GT56nNEU0oNVvic0dfPfveQYBaI8wL58loks3vj2ybSZmziU1mJ0aGV7+klr5fog
    PR0ChyCYYOKUSkNzxWdEizet/viGNOWs/91Q0997yy1ctxNrZDFpPRZae99h6BVy
    k8PKWTeqES8Obsmo4FTu/CgW3chRxoMQ7zp85WnDj716C4a9iQv9WL5HTCsBqRIa
    frz9V+eHegAS0EG6k6cI0w6wRKMLQQJ1YNvDuFbvg53VL1I7RF+79916PM+Mi9vy
    D/9NiJBHZAGUllQWsrC1hDVxmt0bAnofQ65DfNjpS+mpWzA3LOXSary45UU=

    ======================== SAMPLE-WORKING.eml : END ========================

    Plugin Author Meitar

    (@meitar)

    Hmm, that doesn’t look like the emails my test site is producing. Can you confirm if you are using a plugin as well? Maybe Contact Form 7?

    Plugin Author Meitar

    (@meitar)

    I confirmed this is a problem with Contact Form 7 and that without that plugin (i.e., the built-in WordPress email sending) the S/MIME encryption and decryption succeeds. I’m not totally sure yet if the incompatibility with Contact Form 7 is something I can fix on my side, or if I need to to submit a patch Contact Form 7 to make it play nice with encrypted emails. I will report back when I have more details.

    Plugin Author Meitar

    (@meitar)

    @linmp I have released version 0.6.3 which fixes the incompatibility with Contact Form 7 in my testing. The issue was caused by superfluous newlines that were added by Contact Form 7, causing the various emailing routines to handle some header lines as though they were body lines. This has been fixed on my end without needing a patch for the Contact Form 7 upstream by more rigorously checking and filtering out any empty header lines, which means this fix should work reliably forever. 🙂

    Please let me know how this works for you. Thanks again for your help testing it out!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Accept also S/MIME keys’ is closed to new replies.