From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yAWfBrC+zGELSAAAgWs5BA (envelope-from ) for ; Wed, 29 Dec 2021 21:01:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IIHOOq++zGHqNwEAG6o9tA (envelope-from ) for ; Wed, 29 Dec 2021 21:01:51 +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 79B813756A for ; Wed, 29 Dec 2021 21:01:51 +0100 (CET) Received: from localhost ([::1]:56606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2f8v-0002zy-N3 for larch@yhetil.org; Wed, 29 Dec 2021 15:01:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2f7h-0002zo-97 for emacs-orgmode@gnu.org; Wed, 29 Dec 2021 15:00:33 -0500 Received: from mail-oln040092073034.outbound.protection.outlook.com ([40.92.73.34]:42460 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2f7d-0002gg-SL for emacs-orgmode@gnu.org; Wed, 29 Dec 2021 15:00:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lk6Hme6kcSGlLix1qdy6lUuUJaBa+j5Zyy+iuUMhxTi4OM3m0eMkEObNdYOLjZQx27dUX/cw26DYSHX40LwjP889T1/yAns6zUT6LSGgFkuE5tO31BNd1zDAYdjJPVNH3aOfZK8EFH2VRqRW9MT+l/TzynxX13wqfI8cTE4fJTpqEAa0v1d9+EALis9uIQoV4eo2NhRCMA9rZK+GAoWOSE5xAhNbpH0GS1hb5SroPmALy+td6dUGlEDrU23OVeFh/ANUQ1wrwU0Bk4GpuFcSYAvrlhd3t8ZdjBO6gnxcglGIHo05GZHqAcQww+/LyfZ5bbV7bfzDACekhbKxTf7QPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q75WGYrfSrgvZQgKzshiLsl6anWiiKYH6wkb7C99YpY=; b=dAmkEfg+Pny1zEVRfnUaYrrhS8rc1egU0V/p8/W74+HVnpQX+nJ/3W46q6m7SNXfU3R4oA/dGYr8/18vEhNuY6/bP8zDBNhX80RahTERFzLlzq7EnXeyArzkDa1uoBZXJQ/l7KYh4A0FdMy+1fN702BNN5wVXNvrzjxiKUZbji7ppvQS8GJ51AVnIjJ31tXpK7qfWJ8ieUJRI61OAVKbsldpfAN8Q86gxBcSFBYErcx/oGIXgnPc7ZQSi0biLTOyc25AmB1EA7jW1tFPOEPjhA8WE7DbF6ZV9JXLHdRjSapI2SgN4v+gmuVcbXs/FhjUQRE8j0AjkrvthG+BlZh/jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q75WGYrfSrgvZQgKzshiLsl6anWiiKYH6wkb7C99YpY=; b=cXDYhxrdj/qfGGxgHFeAxbDB1ONfRTMbKybumEfScbFmWoj17FgfkRx+aaxM9zJdUxXXaH4AH0XX7rIwGI8Zj9TY8rDwCZydUH2JA88wgepWrlsBxm9LXx/B72do1T0XxqzIgc92bYq41z/W+vXUv4VNnlo9rECkPX7tf0IBH2XTzNHZvrZ4WvWvXGNcojwMIpT++ErX1CHAbmdxSLg4UrosH3z0jantbmV3W+an1lq0Gu03zeHARfr/54MxVXZQQcER3hJqmN63OzQMgpC/oFKcs+2WTfEHOVzLw38lRXF2BzS2lQTLHfh/rabtbKVxUroP70nKLbi6p0n40cdUIw== Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by PR1PR06MB4747.eurprd06.prod.outlook.com (2603:10a6:102:12::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Wed, 29 Dec 2021 19:39:57 +0000 Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::d95b:f98:a588:273]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::d95b:f98:a588:273%8]) with mapi id 15.20.4823.023; Wed, 29 Dec 2021 19:39:57 +0000 User-agent: mu4e 1.2.0; emacs 26.3 From: Ignacio Casso To: emacs-orgmode@gnu.org Subject: [BUG] org-crypt: CRYPTKEY property does not work as expected [9.5.1 (9.5.1-g36086a @ /home/ignacio/.emacs.d/elpa/org-9.5.1/)] Message-ID: Date: Wed, 29 Dec 2021 20:39:50 +0100 Content-Type: text/plain X-TMN: [pHXzCVh60hb015KmtqJ1EUbj3lYNVmAM] X-ClientProxiedBy: MRXP264CA0001.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::13) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87v8z7mcae.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 548df55a-23ab-4427-635f-08d9cb02fea5 X-MS-TrafficTypeDiagnostic: PR1PR06MB4747:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OljjUhV2sDT3Tj+qDVGZ0NJ/LGaUtCykI+lXd35EOQYQv1h9aS4q1KaKCxDQ+uOqBe5+b/VqgeAASvfXe/VEQzIikmPEMCNwaA/+fqPieFnuXqHOG0gDurFG/3d63qujCP7MGXCPLh4s3d8CXvHHKRhXJHLcxo2MlUKgxsEFDcIiMuKGoTmND9aLWyblALeFjtBpY4rNGHVd3CcBev91uiiT46nTy9KtnimYVup6EBF2SFmq0hT75oXC+oh8LxyBUDQyteDZ2At5i9YEx4XmRmuiDYe4wlUFZsbfC8rTn9HpSutGeIptiJkHx343kNH9UIQI7bkWBrmHZiCY3RVvLtzLRNHBpBiFAxdFat8WULLlzD+58qRINmzSGRCK9fJHoSyhydPWZr6YFvfxJmTaI+dljqNM/M/USplF4YRrNNdDYN+hNLK1qSKBC+PhsvJ+2RW+UWDJiA64lp28ELI9/gfZdv7zY9RsIYDKQA/xXIm/Jo4JsVJxtZMg/nHLIH40VnYUCcFU/Ucr+6vDSx2taBAOPMEZxwwZqld40wo/19lfVeJLXW0kvUQRxmY1wkOWeMRcPfg9qppVTCNE/vusWg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ymgIY1xCi3QXbjuNQPtbINiom0K0AfhI/LmSmwVTqw+1e+ot68Hpx5HfJVQh?= =?us-ascii?Q?p8J3KGruDnOh2SMg6/bFlKi/n+Wi0TW2DYefEvVTLS9MSgKvGssmo3Px9PYw?= =?us-ascii?Q?f2o3qZFCyh3ruBKGYiuUEcrSdH2yaGBDhQ9/SC/IG6Kbd240qaGTw+eF/Zh0?= =?us-ascii?Q?/ds/6mVZ6BGdwWMCD3r1ngBTrAUsx2Z3UJaI+7DCY1aurHfAztZPCOPbTE+R?= =?us-ascii?Q?zMSEvt8gEeNDdbkyhDZpUFNmncRqH2oiAuvZj8RgfFz0GrrK9I0x8g/XkSOT?= =?us-ascii?Q?aK4gPINN8JhavC/5lz96GdNtkTpW9bNQ8276NCxjCviNISuu7snnPXHrCnIU?= =?us-ascii?Q?+yWZL1TsVVSNy9mKQrBdibUeglW/vN7AW+lbiehyKrCU4h8VpjYSIFdShmAb?= =?us-ascii?Q?GHZq6qJwkdezBjkYy5Uy3IomwW2cNR5a7RO4+0xadd+jz3hTLA2sDNUX9RnR?= =?us-ascii?Q?ZcYNQdZCt7gp+Ge3fkeuE7TIxD4cCg8jF/pnlmMM8RI+LqUBqI8Z6xeCWA4J?= =?us-ascii?Q?bnhF/npNv0iq58mLKrvopf7nm2dCQmb9dS0vBoaMbO6keA0ASulVT6yqZ+fN?= =?us-ascii?Q?8+HU+18VtmB0639ULLVxRVDVpcaYPiS2S8aNyPTIusyPKJ0VJevCxVV6x6hT?= =?us-ascii?Q?JOtRuRSgiR5IbcWnPLK+bOdUXsI1ZTNRpn7GAd1JsEj5WEaHLDYml2+3sxDy?= =?us-ascii?Q?5m0GCG4EUKO6F9m8IPn7lIE1mBzgcbhirdL6Lyfm1A3XPO+LTnG44pcS0guN?= =?us-ascii?Q?vH0TJpn1vZbHDBLojR5dg4/5w8/msAKKFolg8H4Um2Ef+JBIzrJaIZqLEFj1?= =?us-ascii?Q?E6fvlJRgdMSjJ/BpfSbkIfLzVPI+9nYbbgQ+dw6fEmRJ+LfUsb63zPz0nWIX?= =?us-ascii?Q?RuiuiGFUDKAlI/2rxrgvb3ZQRLwalGgJC7bIo4Kh0aEs1Uh1cCJd11YiFjl6?= =?us-ascii?Q?YNM3Q5ysLlDXNxAE3lErog=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 548df55a-23ab-4427-635f-08d9cb02fea5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2021 19:39:57.5755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR1PR06MB4747 Received-SPF: pass client-ip=40.92.73.34; envelope-from=ignaciocasso@hotmail.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640808111; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=q75WGYrfSrgvZQgKzshiLsl6anWiiKYH6wkb7C99YpY=; b=UUhmZqPXlhKdZQFPOT7U/2aGead1U5O784LeNr//LzihgBZgeeFFQJPx4KGWJQvAOP6Q4B LBvUk4qFFkCJ7B2mwFUqJrKtPqxw+EeAHL+taB4RRXaVE9dZO+zY+VP4JQ7C93+TSgdafa B9GSjMgbvbJAsR9dsznyt1wcguGebv/xyWC/GWTw76b4P8b1MXIItYrmLJi+vZAT3FZvNF u563g60pm0TwA1kU7eR6pAiY/i5Wke2l+eN2+eoaxrJM5FjR0N34R/yUq9RLz8UAZxuZvn W/F/+g0FVPub8tjjX0w1zGmxsO8K8J8lvtr7/nt62SRRYDznRZ8ffF+xt/p/ug== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1640808111; a=rsa-sha256; cv=pass; b=W8ABS2oU0sAuXk1r+lLMUvqKP2bXmbU1NC2G+maBLjl/NkUWSAcsGyycJ7KSfqicJMrTZL Yb9i+sVtCcuIInQXf4zdaWTPzVgOYeChVjsBeReI6rzIP1FIDkPQxQ6Hhya5HYbxA6Lhjs Yhhflv027kVbEVd1D0IXLVy+ZtGlQAEunLJ4Lk5xBiG1yXAmXlKvwBcZ+47xNo764QC7XR PXot0qDuTXqYCVHRPEn4acGHRPH/QTScFG6lBzwrCpFTlJhqfrdwVRhPGTEoqa1Qls7ygG v3n/yFBNtgJ74BjljCnw/Xuxe9t7UdNlhMmSd90C9j/d4wA03Ol+/BkCmnAV2g== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=cXDYhxrd; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.com; 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-Migadu-Spam-Score: -5.27 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=cXDYhxrd; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.com; 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-Migadu-Queue-Id: 79B813756A X-Spam-Score: -5.27 X-Migadu-Scanner: scn1.migadu.com X-TUID: 9PgqSrj2h738 Hello, I think I have found a bug in org-crypt, or that org-crypt documentation is not clear enough. The following configuration snippet in the org-crypt section of the org manual, as well as the docstring for org-crypt-key, suggest that a key value of nil can be used to specify symmetric encryption: (setq org-crypt-key nil) ;; GPG key to use for encryption ;; Either the Key ID or set to nil to use symmetric encryption. The same section of the manual, and again the docstring for org-crypt-key, suggest that the value of org-crypt-key can be overridden with the CRYPTKEY property. However, if I set in my configuration org-crypt-key to nil, to use symmetric encryption by default, and try to override it in a heading setting the CRYPTKEY property to one of my keys, it still uses symmetric encryption and prompts me for a password. And if I set in my configuration org-crypt-key to one of my keys, to use it by default, and try to override it in a heading setting the CRYPTKEY property to nil to use symmetric encryption, it still uses my key and does not prompt me for a password. In both cases, if I use as key value a string that does not match any key instead of nil (e.g, the empty string ""), which also means symmetric encryption if epa-file-encrypt-to is not set according to the docstring of org-crypt-key, everything works as expected. So maybe that is the only value that should be used to specify symmetric encryption when you want to combine it with asymmetric encryption depending of the file or entry, but if that is the case I think the documentation does not insist on that fact enough. It's true that the docstring for org-crypt-key does say "If this variable is nil, always use symmetric encryption, unconditionally.", and that "unconditionally" could be interpreted as even if a CRYPTKEY property has been set, but for me that is not clear enough and I only considered that interpretation after having this issue and debugging it for a while. To exhibit the behaviour exposed, the following simple org and init files and playing around with the value of org-crypt-key suffice: Org file: * Encrypted heading 1 :crypt: :PROPERTIES: :CRYPTKEY: :END: This text should be encrypted using , regardless of the value of org-crypt-key * Encrypted heading 2 :crypt: :PROPERTIES: :CRYPTKEY: nil :END: This text should be encrypted using symmetric encryption, regardless of the value of org-crypt-key Init file: (require 'package) (package-initialize) (require 'org) (require 'org-crypt) (org-crypt-use-before-save-magic) (add-to-list 'org-tags-exclude-from-inheritance "crypt") (customize-set-variable org-crypt-disable-auto-save t) (setq org-crypt-key nil) ;; (setq org-crypt-key "") Emacs : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian Package: Org mode version 9.5.1 (9.5.1-g36086a @ /home/ignacio/.emacs.d/elpa/org-9.5.1/)