[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gpg --list-only, etc.
From: |
Sai Karthik |
Subject: |
Re: gpg --list-only, etc. |
Date: |
Mon, 07 Jun 2021 03:47:00 +0000 |
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"))))
>
>