Finding all files encrypted with a certain key

raf gnupg at
Wed Oct 25 15:27:18 CEST 2023

On Wed, Oct 25, 2023 at 11:01:30AM +0800, "Felix E. Klee" <felix.kleei at> wrote:

> On Tue, Oct 24, 2023 at 5:12?PM Andrew Gallagher <andrewg at>
> wrote:
> > GNU `file` will print the encryption key ID:
> Interesting. I wonder if there is any disadvantage of using `file` over
> Werner's proposal.

I don't think so. The version you are quoting didn't
use find(1) as well, so it doesn't search recursively,
but apart from that, using file would be simpler (no
decryption, and no need to think about pinentry, and no
need to access keys). If the files you are searching
for are gigabytes in size, and there are many of them,
decrypting them to find the key would be too slow,
unless I've misunderstood something. file would read
much less of each file. No, gpg would die with SIGPIPE
as soon as awk terminates, so they probably read a
similar amount. And they both use multiple additional
processes for each candidate file (either sh+file+grep
or sh+gpg+awk).


More information about the Gnupg-users mailing list