From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6FIvMb7LcWFHawEAgWs5BA (envelope-from ) for ; Thu, 21 Oct 2021 22:21:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +CvXLL7LcWGJQAAAB5/wlQ (envelope-from ) for ; Thu, 21 Oct 2021 20:21:18 +0000 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 5A15010589 for ; Thu, 21 Oct 2021 22:21:18 +0200 (CEST) Received: from localhost ([::1]:38176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdeYv-0004We-Eg for larch@yhetil.org; Thu, 21 Oct 2021 16:21:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdeRc-0005PG-0M for guix-devel@gnu.org; Thu, 21 Oct 2021 16:13:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35546) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdeRb-00008Z-Nm; Thu, 21 Oct 2021 16:13:43 -0400 Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52029 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdeRb-0004Cv-E6; Thu, 21 Oct 2021 16:13:43 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Liliana Marie Prikler Subject: Re: Using G-Expressions for public keys (substitutes and possibly more) References: <5f7e587c376ed0abffa321152e185cbf4014e05b.camel@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 30 =?utf-8?Q?Vend=C3=A9miaire?= an 230 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 21 Oct 2021 22:13:40 +0200 In-Reply-To: <5f7e587c376ed0abffa321152e185cbf4014e05b.camel@gmail.com> (Liliana Marie Prikler's message of "Sun, 17 Oct 2021 14:47:21 +0200") Message-ID: <87wnm6w2yz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634847678; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rKJo1R23TdZGf1tMzo6LrJQo+nqE2jXndGBnJ+bqUYw=; b=mqxsE+64dOxR2lm4tXejFCYzQFhTp19pCAXNe89GCi2qhCZSiF9eiD5PnbzpsiI817Ioj0 tT0XQ8gJOaSgl5wsCVwry/s8hkdSSb17zG0OKS+UUKNUCcncpXbmvtxyOhGSiAqfGd1GDR 9VKc03DRJgOmlbyCn6KSv3989DiXRE2jKVggDuEONHzO1VTzo4+u3xgOwpRLp6q6FSzimh CrJIOkuZjX7eqyIk5o6I466JTklVJ2IsQsVinpj137+rAgjDJ76G7X6gF90TeurA59uHah gcA8Hz8aaMw/4hz9wTKvZsMPwB7pmFcmM/K9r8U80vTIMT5wfI9//BZG0Q6DCg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634847678; a=rsa-sha256; cv=none; b=U+ADd2070QYKIGH1a7sO9TLoPawdh+MAFHPZlaXPw1LcYm5yDf5lFySX0aQuPLRrCR0u+d oX7MB6p1pOkW3PiB+fr34I8vTmfs/cw0hOOzLOC8GbT1Si4Bcm9zbE4PwNFCSXev8Lej0a ZBfrqhZE9V6AhEnM38LIvBB12nSexGPiy1u7rtJhOcGKSHx0XmNd5uKI1+PJq9yKmo5ncB PexjBQP/kpZsjQC7ta8Yb4Fhts9G3OnXqbyxbsywgC32FG97PkyxzmZUQSvfi1LaoyOMfg vRR1F4OWr0HO8FN+3oXFnmNKMVCv7GNUuM99ckbo5kb0O+hYr0J8Kc/DRn+vUA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.53 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 5A15010589 X-Spam-Score: -3.53 X-Migadu-Scanner: scn1.migadu.com X-TUID: 55jXHbXTmxEQ Hi! Liliana Marie Prikler skribis: > let's say I wanted to add my own substitute server to my config.scm.=20 > At the time of writing, I would have to add said server's public key to > the authorized-keys of my guix-configuration like so: > (cons* (local-file "my-key.pub") %default-authorized-guix-keys) > or similarily with append. This local-file incantation is however > pretty weak. It changes based on the current working directory and > even if I were to use an absolute path, I'd have to copy both that file > and the config.scm to a new machine were I to use the same > configuration there as well. Note that you could use =E2=80=98plain-file=E2=80=99 instead of =E2=80=98lo= cal-file=E2=80=99 and inline the key canonical sexp in there. > However, it turns out that the format for said key files is some > actually pretty readable Lisp-esque stuff. For instance, an ECC key > reads like > (public-key (ecc (curve CURVE) (q #Q#))) > with spaces omitted for simplicity. > Were it not for the (q #Q#) bit, we could construct it using scheme- > file. In fact, it is so simple that in my local config I now do > exactly that. Yeah it=E2=80=99s frustrating that canonical sexps are almost, but not quit= e, Scheme sexps. :-) (gcrypt pk-crypto) has a =E2=80=98canonical-sexp->sexp=E2=80=99 procedure: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(gcrypt pk-crypto) scheme@(guile-user)> ,use(rnrs io ports) scheme@(guile-user)> (string->canonical-sexp (call-with-input-file "etc/substitutes/ci.guix.info.pub" get-string-all)) $18 =3D # scheme@(guile-user)> ,pp (canonical-sexp->sexp $18) $19 =3D (public-key (ecc (curve Ed25519) (q #vu8(141 21 111 41 93 36 176 217 168 111 165 116 26 132 15 242 21= 0 79 96 247 182 196 19 72 20 173 85 98 89 113 179 148)))) --8<---------------cut here---------------end--------------->8--- > (define-record-type* ...) > (define-gexp-compiler (ecc-key-compiler (ecc-key ) ...) ...) > > (ecc-key > (name "my-key.pub") > (curve 'Ed25519) > (q "ABCDE...")) > > Could/should we support such formats out of the box? WDYT? With this approach, we=E2=80=99d end up mirroring all the canonical sexps u= sed by libgcrypt, which doesn=E2=80=99t sound great from a maintenance POV. Would providing an example in the doc that uses =E2=80=98canonical-sexp->se= xp=E2=80=99 and its dual help? Thanks, Ludo=E2=80=99.