Finding all files encrypted with a certain key

Werner Koch wk at gnupg.org
Wed Oct 25 15:22:37 CEST 2023


On Wed, 25 Oct 2023 10:54, Felix E. Klee said:

> Thank you! I modified that a bit, to make it more readable to me and fix
> a little bug: The second `$1` doesn’t expand to the file name. Also, I

Upoi caught me, I didn't test the posted version.

>     gpg: decryption failed: No secret key
>
> I wonder how to get rid of that.

grep -v on stderr ;-).

I think it is time to make things like this easier.  Actually re-encrypt
support has been on our feature list for many years.  Every time I want
to tackle this I stop at the descsion on whether to to also handle the
large file on server shall be re-encrypted ot on teh simple re-encrypt a copy.

>
> My version:
>
>     #/bin/sh
>
>     filename=$1
>     enc_sub_key=04FDF78D1679DD94
>
>     gpg --decrypt \
>         --pinentry-mode cancel \
>         --status-fd 1 \
>         --quiet \
>         --output /dev/null "$1" |
>         awk -v filename="$filename" \
>             -v enc_sub_key="$enc_sub_key" \
>             '
>             $1=="[GNUPG:]" &&
>             $2=="ENC_TO" &&
>             $3==enc_sub_key {
>                     print filename
>                     exit 0
>             }'
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at gnupg.org
> https://lists.gnupg.org/mailman/listinfo/gnupg-users

-- 
The pioneers of a warless world are the youth that
refuse military service.             - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 247 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20231025/1b919361/attachment.sig>


More information about the Gnupg-users mailing list