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().