aboutsummaryrefslogtreecommitdiffhomepage
path: root/crypto.c
Commit message (Collapse)AuthorAge
* crypto: return NULL cryptoctx if protocol string is empty.Gravatar Jameson Graef Rollins2013-07-20
| | | | | | | | Badly formed messages that don't specify a protocol in signed/encrypted parts, end up with a protocol of NULL. strcasecmp in notmuch_crypto_get_context then segfaults when trying to check it against known protocols. If the protocol is NULL, just return an empty context immediately (with appropriate message.)
* cli: crypto: abstract gpg context creation for clarityGravatar Jani Nikula2013-04-01
| | | | | | | | The code filled with #ifdef GMIME_ATLEAST_26 is difficult to read. Abstract gpg context creation into a function, with separate implementations for GMime 2.4 and 2.6, to clarify the code. There should be no functional changes.
* cli: crypto: tell gmime to use gpg-agentGravatar Jani Nikula2013-03-02
| | | | | | | | | | | | | | | | | | | | | | | | | For decryption, we expect there to be a functioning gpg-agent, and we want gpg to talk to it for any needed credentials. There's a gmime function to declare that: g_mime_gpg_context_set_use_agent() [1], [2]. Start using it. I had gpg-agent running, but gpg "use-agent" configuration option disabled. This resulted in an error message from 'notmuch show': Failed to decrypt part: Canceled. and json had this: "encstatus" : [ { "status" : "bad" } ] One could argue the "use-agent" option should be enabled, but I'd like to use the agent only as a last resort. I think that's irrelevant though. There's a gmime function to declare what we expect, so we should use it. Conveniently it also fixes the problem in a user friendly way. [1] http://git.gnome.org/browse/gmime/commit/?id=ed985397843a9da3745a8b5de3d1d652acd24724 [2] https://bugzilla.gnome.org/show_bug.cgi?id=651826
* cli: new crypto structure to store crypto contexts and parameters, and ↵Gravatar Jameson Graef Rollins2012-06-10
functions to support it This new structure, notmuch_crypto_t, keeps all relevant crypto contexts and parameters together, and will make it easier to pass the stuff around and clean it up. The name of the crypto context inside this new struct will change, to reflect that it is actually a GPG context, which is a sub type of Crypto context. There are other types of Crypto contexts (Pkcs7 in particular, which we hope to support) so we want to be clear. The new crypto.c contains functions to return the proper context from the struct for a given protocol (and initialize it if needed), and to cleanup a struct by releasing the crypto contexts.