On 2016-06-26 09:23, A.L.E.C wrote:
On 06/26/2016 01:47 AM, Kyle Francis wrote:
I hit a road block and I've kind of been putting off finishing up the SMIME support because of it. I originally didn't have a password protected private keys for testing purposes, but have now added that. Prior to that signing and decrypting worked just fine. Now with the password, I can get Enigma to prompt for the password if it's not cached for signing outgoing (in the compose task) but I'm not able to figure out how to get it to prompt for the password from the inbox task when attempting to decrypt a message. If the password is cached the message decrypts perfectly.
The result of decryption is handled in enigma_ui::status_message() method (https://github.com/roundcube/roundcubemail/blob/master/plugins/enigma/lib/en...).
So, we prompt for password when $engine->decryptions array contains enigma_error object for specified message part. The code of the error should be enigma_error::BADPASS. In this case it is important which message part ID you're using.
The same applies for when you reply to an encrypted message. See enigma_ui::message_compose(). Here we also use $engine->decryptions property, but here the part ID is irrelevant.
How we set $decryptions property you can see for example in enigma_engine::parse_plain_encrypted() and enigma_driver_gnupg::get_error_from_exception().
Alec,
Thanks for the guidance. I was putting the enigma_error::BADPASS into the $engine->decryptions array, but thanks to your advise I found that the enigma_ui::find_part_id call in enigma_ui::status_message is not returning the expected result, since S/MIME messages are formatted differently than PGP ones. I'm working on adding some logic to the enigma_ui::find_part_id function to detect and handle SMIME formatted messages. Hopefully that will work out!
-Kyle