]> git.notmuchmail.org Git - notmuch/commit
crypto: use stashed session-key properties for decryption, if available
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 30 Nov 2017 08:59:29 +0000 (03:59 -0500)
committerDavid Bremner <david@tethera.net>
Tue, 5 Dec 2017 01:48:31 +0000 (21:48 -0400)
commita99058540823cd520cf2a5333e8ffe99799aa285
tree7377688a29dd6268240efab76b08b904a1a17ad8
parent0ff13f862cd817fc1971900a433856a2a6146e24
crypto: use stashed session-key properties for decryption, if available

When doing any decryption, if the notmuch database knows of any
session keys associated with the message in question, try them before
defaulting to using default symmetric crypto.

This changeset does the primary work in _notmuch_crypto_decrypt, which
grows some new parameters to handle it.

The primary advantage this patch offers is a significant speedup when
rendering large encrypted threads ("notmuch show") if session keys
happen to be cached.

Additionally, it permits message composition without access to
asymmetric secret keys ("notmuch reply"); and it permits recovering a
cleartext index when reindexing after a "notmuch restore" for those
messages that already have a session key stored.

Note that we may try multiple decryptions here (e.g. if there are
multiple session keys in the database), but we will ignore and throw
away all the GMime errors except for those that come from last
decryption attempt.  Since we don't necessarily know at the time of
the decryption that this *is* the last decryption attempt, we'll ask
for the errors each time anyway.

This does nothing if no session keys are stashed in the database,
which is fine.  Actually stashing session keys in the database will
come as a subsequent patch.
doc/man7/notmuch-properties.rst
lib/index.cc
mime-node.c
util/crypto.c
util/crypto.h