From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id BEEEC6DE100F for ; Thu, 16 Nov 2017 08:13:45 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.115 X-Spam-Level: X-Spam-Status: No, score=0.115 tagged_above=-999 required=5 tests=[AWL=-0.105, RDNS_NONE=0.2, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UOp6fDBO82yE for ; Thu, 16 Nov 2017 08:13:40 -0800 (PST) Received: from fethera.tethera.net (unknown [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 8EC6A6DE10F9 for ; Thu, 16 Nov 2017 08:13:22 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1eFJfQ-00080M-3O; Thu, 16 Nov 2017 07:53:16 -0500 Received: (nullmailer pid 30546 invoked by uid 1000); Thu, 16 Nov 2017 12:53:14 -0000 From: David Bremner To: Daniel Kahn Gillmor , Notmuch Mail Subject: Re: [PATCH 15/18] crypto: actually stash session keys when try-decrypt=true In-Reply-To: <20171025065203.24403-16-dkg@fifthhorseman.net> References: <20171025065203.24403-1-dkg@fifthhorseman.net> <20171025065203.24403-16-dkg@fifthhorseman.net> Date: Thu, 16 Nov 2017 08:53:14 -0400 Message-ID: <87tvxu8jwl.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2017 16:13:45 -0000 Daniel Kahn Gillmor writes: > + Be aware that the index is likely sufficient to reconstruct > + the cleartext of the message itself, so please ensure that the > + notmuch message index is adequately protected. DO NOT USE > + ``--try-decrypt=true`` without considering the security of > + your index. > This is probably just my ignorance, but doesn't stashing session keys change this from likely to certain? Is it possible we decrypt thing and don't get session keys. > +test_begin_subtest "show the message body of the encrypted message" > +notmuch dump wumpus > +output=$(notmuch show wumpus | awk '/^\014part}/{ f=0 }; { if (f) { print $0 } } /^\014part{ ID: 3/{ f=1 }') > +expected='This is a test encrypted message with a wumpus.' > +test_expect_equal \ > + "$output" \ > + "$expected" I'd be happier if we didn't further entrench the text format in the test suite. How hard would it be to use json output (+maybe python?) here? > *attempted = true; > #if (GMIME_MAJOR_VERSION < 3) > +#if (GMIME_MAJOR_VERSION == 2 && GMIME_MINOR_VERSION == 6 && GMIME_MICRO_VERSION >= 21) > + gboolean oldgetsk = g_mime_crypto_context_get_retrieve_session_key (crypto_ctx); > + gboolean newgetsk = (decrypt_result); > + if (newgetsk != oldgetsk) > + /* This could return an error, but we can't do anything about it, so ignore it */ > + g_mime_crypto_context_set_retrieve_session_key (crypto_ctx, newgetsk, NULL); > +#endif > ret = g_mime_multipart_encrypted_decrypt(part, crypto_ctx, > decrypt_result, err); > +#if (GMIME_MAJOR_VERSION == 2 && GMIME_MINOR_VERSION == 6 && GMIME_MICRO_VERSION >= 21) > + if (newgetsk != oldgetsk) > + g_mime_crypto_context_set_retrieve_session_key (crypto_ctx, oldgetsk, NULL); I lost track a bit, but now there's at least 2 (maybe 3) repetitions of this somewhat complicated test, and one more needed for built_with.session_keys. HAVE_GMIME_SESSION_KEYS is looking better and better.