From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#19960: epg: allow passing --keyring values via new epg-context-keyrings Date: Fri, 27 Feb 2015 16:12:49 +0000 Message-ID: <87lhjj1gfy.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1425053663 13894 80.91.229.3 (27 Feb 2015 16:14:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Feb 2015 16:14:23 +0000 (UTC) To: 19960@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 27 17:14:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YRNYK-0007ZG-Ls for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Feb 2015 17:14:12 +0100 Original-Received: from localhost ([::1]:37249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNYJ-0002MG-Ve for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Feb 2015 11:14:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNYF-0002LI-Pz for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:14:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRNYD-0003tQ-3F for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:14:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNYA-0003sm-Vg for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:14:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YRNYA-0006Lq-Jc for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Feb 2015 16:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19960 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142505358324335 (code B ref -1); Fri, 27 Feb 2015 16:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Feb 2015 16:13:03 +0000 Original-Received: from localhost ([127.0.0.1]:60133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YRNXC-0006KQ-Ti for submit@debbugs.gnu.org; Fri, 27 Feb 2015 11:13:03 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:56966) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YRNXA-0006K2-1S for submit@debbugs.gnu.org; Fri, 27 Feb 2015 11:13:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=JpeoX90v773hQgGew4h3UP/4xVorms/+K7SFWh+3T+U=; b=mQLy7EuLIXzjusKObqu1CWBoHzYnMRJSsqHJvWATbtMekjbfqXYHJYohKhi4KoTbC+q3zwQwNipbqQl35gxzO57pG3QruH/ER8QtzycBipBJPKLPCsXuyc9jgtvCS/WCC4VyjuzgN2w10/47GNwW7fx1CMonYPq9OqehgDFr5tI=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YRNX8-00058k-Q6 for submit@debbugs.gnu.org; Fri, 27 Feb 2015 16:12:58 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YRNX0-0001qD-GA for submit@debbugs.gnu.org; Fri, 27 Feb 2015 23:12:50 +0700 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99872 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: wishlist Tags: patch Please consider the patch MIMEd. * lisp/epg.el (epg-context): New slot: keyrings. (epg--start): Use it. (epg--list-keys-1): Likewise. (Bug#???) An example code making use of this change (assuming that the extra keyring is available at the location usual to Debian Jessie) is also MIMEd. (Tested on 619fc5c197eb, 2015-02-26 18:09:48 UTC.) --=20 FSF associate member #7257 np. Gates of Tomorrow =E2=80=94 Iron Maiden = =E2=80=A6 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline diff --git a/lisp/epg.el b/lisp/epg.el index f665453..0768697 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -197,6 +197,7 @@ cl-defstruct epg-context protocol program (home-directory epg-gpg-home-directory) + keyrings armor textmode include-certs @@ -570,6 +571,11 @@ defun epg--start (context args) (if (epg-context-home-directory context) (list "--homedir" (epg-context-home-directory context))) + (if (epg-context-keyrings context) + (apply #'nconc + (mapcar (lambda (elt) + (list "--keyring" elt)) + (epg-context-keyrings context)))) (unless (eq (epg-context-protocol context) 'CMS) '("--command-fd" "0")) (if (epg-context-armor context) '("--armor")) @@ -1263,6 +1269,11 @@ defun epg--list-keys-1 (context name mode) (let ((args (append (if (epg-context-home-directory context) (list "--homedir" (epg-context-home-directory context))) + (if (epg-context-keyrings context) + (apply #'nconc + (mapcar (lambda (elt) + (list "--keyring" elt)) + (epg-context-keyrings context)))) '("--with-colons" "--no-greeting" "--batch" "--with-fingerprint" "--with-fingerprint") (unless (eq (epg-context-protocol context) 'CMS) --=-=-= Content-Type: text/emacs-lisp Content-Disposition: inline (let ((cx (epg-make-context 'OpenPGP)) (s (with-current-buffer (url-retrieve-synchronously "http://snapshot.debian.org/archive/debian/20140501T070413Z/dists/jessie/InRelease") (buffer-substring-no-properties url-http-end-of-headers (point-max)))) a b) (setq a (progn (epg-verify-string cx s) (epg-context-result-for cx 'verify))) (push "/etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg" (epg-context-keyrings cx)) (setq b (progn (epg-verify-string cx s) (epg-context-result-for cx 'verify))) ;; . (list a b)) ;; Expected result: ; (([cl-struct-epg-signature ; no-pubkey "8B48AD6246925553" nil nil ; (21345 . 47158) nil 1 8 1 nil nil]) ; ([cl-struct-epg-signature ; good "8B48AD6246925553" undefined ; "A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553" ; (21345 . 47158) nil 1 8 1 4 nil])) --=-=-=--