unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Sai Karthik <kskarthik@disroot.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: gpg --list-only, etc.
Date: Sun, 6 Jun 2021 19:37:29 +0300	[thread overview]
Message-ID: <YLz5yd2MKOllOSL6@protected.localdomain> (raw)
In-Reply-To: <8D4ECE71-8388-4323-9F0D-E5A5DF9F0B87@disroot.org>

* Sai Karthik <kskarthik@disroot.org> [2021-06-06 18:29]:
> Hello, is there any way to list all recipients of a gpg file using
> epa? couldn't find anything useful from the manual
> (https://www.gnu.org/software/emacs/manual/html_mono/epa.html)

GnuPG: list all recipients of a message | End Point
https://www.endpoint.com/blog/2013/05/24/gnupg-list-all-recipients-of-message

Command is:
gpg --list-only --no-default-keyring --secret-keyring /dev/null $infile

I could not find "list-only" in epa*.el libraries, it is most probably
not there.

This will do, modify it as you wish, as I use `rcd-utilities.el' from: 

GNU Emacs package: rcd-utilities.el :
https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html


(defun rcd-gpg-list-only (encrypted)
  "Return list of recipients for ENCRYPTED string."
  (if (rcd-which "gpg")
      (rcd-command-output-from-input "gpg" encrypted "--list-only" "--no-default-keyring" "--secret-keyring" "/dev/null")
    (rcd-warning-message "RCD ERROR: `gpg' not found in $PATH")))


(defun rcd-gpg-list-recipients ()
  "Return list of GPG recipients either in Dired or for region.

If region is marked it will act on region, otherwise it may
handle current Dired file."
  (interactive)
  (if (eq major-mode 'dired-mode)
      (let ((file (car (dired-get-marked-files))))
	(message
	 (rcd-gpg-list-only
	  (with-temp-buffer
	    (insert-file-contents-literally file) 
	    (buffer-string)))))
    (if (region-active-p) 
	(message (rcd-gpg-list-only (rcd-region-string)))
      (rcd-warning-message "Did not find valid encrypted region or file"))))


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2021-06-06 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06  8:06 (unknown) Sai Karthik
2021-06-06 16:37 ` Jean Louis [this message]
2021-06-07  3:47   ` gpg --list-only, etc Sai Karthik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLz5yd2MKOllOSL6@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=kskarthik@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).