all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (unknown)
@ 2021-06-06  8:06 Sai Karthik
  2021-06-06 16:37 ` gpg --list-only, etc Jean Louis
  0 siblings, 1 reply; 3+ messages in thread
From: Sai Karthik @ 2021-06-06  8:06 UTC (permalink / raw)
  To: help-gnu-emacs

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)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gpg --list-only, etc.
  2021-06-06  8:06 (unknown) Sai Karthik
@ 2021-06-06 16:37 ` Jean Louis
  2021-06-07  3:47   ` Sai Karthik
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Louis @ 2021-06-06 16:37 UTC (permalink / raw)
  To: Sai Karthik; +Cc: help-gnu-emacs

* 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/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gpg --list-only, etc.
  2021-06-06 16:37 ` gpg --list-only, etc Jean Louis
@ 2021-06-07  3:47   ` Sai Karthik
  0 siblings, 0 replies; 3+ messages in thread
From: Sai Karthik @ 2021-06-07  3:47 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs

Thank you very much for the help! I will try your code. Vim gpg plugin has such feature to list a file's keys. So, I was looking in epa. 

However, Having this feature in epa would be a plus! 

On 6 June 2021 4:37:29 pm UTC, Jean Louis <bugs@gnu.support> wrote:
>* 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"))))
>
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-07  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-06  8:06 (unknown) Sai Karthik
2021-06-06 16:37 ` gpg --list-only, etc Jean Louis
2021-06-07  3:47   ` Sai Karthik

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.