From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oMvlIW1ezmOjEAEAbAwnHQ (envelope-from ) for ; Mon, 23 Jan 2023 11:16:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MJjAIW1ezmNdcQEAauVa8A (envelope-from ) for ; Mon, 23 Jan 2023 11:16:13 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0D85C8671 for ; Mon, 23 Jan 2023 11:16:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJtrZ-0004sH-71; Mon, 23 Jan 2023 05:15:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJtrU-0004oS-CF for emacs-orgmode@gnu.org; Mon, 23 Jan 2023 05:15:36 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJtrR-0007bo-US for emacs-orgmode@gnu.org; Mon, 23 Jan 2023 05:15:36 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A820924003A for ; Mon, 23 Jan 2023 11:15:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1674468931; bh=7YGohmME+8vEnT8X+F1c8C37/yhQE1e69q/DagHpRyM=; h=From:To:Cc:Subject:Date:From; b=VwgEA818OkUsUIkwno7PYvX52NUH5D9HRqauDPjKVpw9tsMqGkiQ+aGNlcz31Rwtr Y+rTtgJjarnwlaSkTxtComciX8hQdBoJ831xXmYwlgCqPwf4XxMopSfblSKNKmntZp LOyCuQ0GWSQtn5p5t4XQOvSTFhzCVqA/+O4jzkb9mkecFH48qzyZsaGeDvYqY3o6T+ MZpL8phn4iYg0nhZ3UKS+twkubaMMxwJa2nIqHTW4ZJc0dTtBjnBpBXS7AOvenped0 kvtUu/CIGSa2pEmw8oq7vtbgky1E3siaoB/rb6A+vFmy+J7RCmWOi5YhtHp8hM87Gs +J9CmUwIzKzQg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P0mFZ1xQqz9rxQ; Mon, 23 Jan 2023 11:15:29 +0100 (CET) From: Ihor Radchenko To: Karl Voit Cc: emacs-orgmode@gnu.org Subject: Re: org-crypt fails if default key is expired while non-default key is to be used In-Reply-To: <2023-01-22T18-32-17@devnull.Karl-Voit.at> References: <2023-01-22T18-32-17@devnull.Karl-Voit.at> Date: Mon, 23 Jan 2023 10:16:02 +0000 Message-ID: <875ycx7dzx.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674468973; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dw6l4FYg68AYK0+AwcapZaxb60qJvTGlCJYwSet8j4s=; b=ShC3mnIH/2JCMsSBSZvHDRs7reSu688gIhXfFy748p9IErgMl/KHbNxQI3881NI1aQFCfx eo7D9BHUqbevgWQ/f4NIAH42r+/KdbbRPfHgg1PgJuj4vHd0rT5tiwCIjyiWTXy5GLxJq0 8MtvrYxF+n9Q7er9QsIco5OLGcuYqXzZTVfyQH5QLM/8d4nvoOcZyfA4HaAtKOz3MsdXgI VcXA1jN8lfcwOjHK+hnBPhJuUdiU/NpQ6i+bAEHJRM+qVI1IEroMWlURVOWVzhKus+pcmt H2wieMnwYqXrfrvsG0jyBxCcdjqNESROK70Bfd4CD4Ds/SJMKSO2Tw2PmbV8jQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=VwgEA818; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674468973; a=rsa-sha256; cv=none; b=L0+3fKz69/ru03tQ4XlAEnhOsveZMh2KsmHJCSRFG0Tj17+hB7UrM7eNIX7QfOCWS8iE5h OgLrieogWHlKnkA2rSR/iyQ72u/8QktNBxrNKKWzvcHj9zEWJCOSLroYSbiSDg2+BwFk/W wYN4hOMIS4uYR+v/BKGrFrTz0b0ujwbVU+34Y3hMAhg+PF7DCoVSYBR2qBQdcDSymRPtpr G8s0iOB9PlILp2P8KzeldtCa+8onCaIfj9cbFQFqlHMDRxRncix3A/KKwXX2l7mKQiaCnS SirZQVKH6Gqj+NVjA3hTGSUGSnZ3XGxqX+019JS8/w6M/233oBrLwqoGJK6DTw== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -6.05 X-Spam-Score: -6.05 X-Migadu-Queue-Id: 0D85C8671 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=VwgEA818; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: /cY4KqYm2XsV Karl Voit writes: > When I invoked org-decrypt-entry, decrypting works like always. Then > I modified something in this heading which is tagged with :crypt:. > On saving that buffer, org-crypt issues an error message: > > | Error: (error "GPG error: \"Encrypt failed\", \"Unusable public key: > | A1234567; Exit\"") > > This A1234567 key is my default key and not the org-openpgp-key. > > org-encrypt-entry is causing this error at: > > | ;; Text and key have to be identical, otherwise we > | ;; re-crypt. > | (if (and (equal crypt-key key) > | (string= checksum (sha1 contents))) > | (get-text-property 0 'org-crypt-text contents) > | (epg-encrypt-string epg-context contents crypt-key))) > > After fixing the expiry date of A1234567, org-crypt was working > properly, using the correct org-openpgp-key again. > > I do think this is wrong behavior: when the default key is expired > but a specific secondary key is used, encryption should be possible. All we do here is calling `epg-encrypt-string' with crypt key obtained using `org-crypt-key-for-heading', which see. May I know how exactly did you set `org-crypt-key'? Do you happen to have CRYPTKEY properties somewhere in your buffer? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at