When I attached S/MIME signing/encryption to RoundCube, I have found that openssl forms the text of the letter, not quite ready to be sent. Some important headers aren't included in this file. Therefore I had to add processing of the letter after openssl.
Best regards,
Vladimir Gorpenko
Kyle Francis писал 2016-05-19 02:31:
So I'm trying to wrap up implementing S/MIME support in the Enigma plugin. I've got cert import (from .p12) implemented, as well as verifying and decrypting working. Certs show up in the Settings menu as well with basic info.
For signing and encrypting openssl_pkcs7_sign/encrypt return fully encoded text files that are ready to be sent by a mail agent, whereas the message_ready hook is looking for a Mail_mime object.
What would be the recommended course, either parse the file to create a Mail_mime object, or would there be a way to pass along the fully mail agent ready text from opening_pkcs7?
Kyle _______________________________________________ Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev
On 05/19/2016 01:31 AM, Kyle Francis wrote:
For signing and encrypting openssl_pkcs7_sign/encrypt return fully encoded text files that are ready to be sent by a mail agent, whereas the message_ready hook is looking for a Mail_mime object.
That's unfortunate. However, if you'd like to sign+encrypt you'll still need to "parse" the message (split headers and body at least), right?
What would be the recommended course, either parse the file to create a Mail_mime object, or would there be a way to pass along the fully mail agent ready text from opening_pkcs7?
For PGP we replace Mail_mime with our wrapper enigma_mime_message, so all logic should be put there. The most important method is get(). I don't see a reason why it wouldn't work. You should start in enigma_engine::sign_message() and encrypt_message(), but you probably saw them already.
I have used additional operators for debuging: writing to RC log and (sometimes) file copying.
Vladimir Gorpenko
Kyle Francis писал 2016-05-19 15:25:
In the wee hours of the morning last night I figured out what was tripping me up. enigma_mime_message::contentHeaders is overriding the same call in Mail_mime. So I added logic in enigma_mime_message for SMIME signed messages, scraping the SMIME signature out of the openssl output and reusing the addPGPsignature method to inject it in the outgoing email. I just need to sort out what headers need to be included when signing (vs sending) and it should be working.
What does everyone use for debugging purposes? I tried using NetBeans/xdebug but it didn't really work for me. Any other recommendations besides file_put_contents? _______________________________________________ Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev
On 05/19/2016 02:25 PM, Kyle Francis wrote:
What does everyone use for debugging purposes? I tried using NetBeans/xdebug but it didn't really work for me. Any other recommendations besides file_put_contents?
rcube::console($variable);
Figured out what I was doing wrong... openssl gives you the S/MIME
signature in base64 encoded form. I was attempting to copy that and
inject it straight into an outgoing message. The problem with that was
the already base64 encoded signature was being base64 encoded a second
time when the Mail_mime object is being prepped for transmission.
Decoding the base64 and then inserting as a binary signature using the
enigma_mime_message::addPGPSignature works.
So signing is now done, just to do encrypting...
On 05/19/2016 08:25 AM, Kyle Francis wrote:
In the wee hours of the morning last night I figured out what was tripping me up. enigma_mime_message::contentHeaders is overriding the same call in Mail_mime. So I added logic in enigma_mime_message for SMIME signed messages, scraping the SMIME signature out of the openssl output and reusing the addPGPsignature method to inject it in the outgoing email. I just need to sort out what headers need to be included when signing (vs sending) and it should be working.
What does everyone use for debugging purposes? I tried using NetBeans/xdebug but it didn't really work for me. Any other recommendations besides file_put_contents?
Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev