help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gpg --list-only, etc.


From: Jean Louis
Subject: Re: gpg --list-only, etc.
Date: Sun, 6 Jun 2021 19:37:29 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* 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 via email to

[Prev in Thread] Current Thread [Next in Thread]