Bulk removal of expired keys

Teemu Likonen tlikonen at iki.fi
Mon Feb 24 20:41:45 CET 2020


jerry at seibercom.net [2020-02-24T07:44:10-05] wrote:

> Is there any similar program for use on a FreeBSD based OS? My primary
> goal is to remove all expired keys and refresh the remaining ones if
> necessary.

For the primary goal of removing expired keys:

    gpg --list-keys --with-colons | awk -F: '
    $1 == "pub" && $2 == "e" {expired = 1}
    $1 == "fpr" && expired == 1 {print $10; expired = 0}' | \
        xargs echo gpg --batch --yes --delete-keys

Remove the "echo" when you are sure.

-- 
///  OpenPGP key: 4E1055DC84E9DFF613D78557719D69D324539450
//  https://keys.openpgp.org/search?q=tlikonen@iki.fi
/  https://keybase.io/tlikonen  https://github.com/tlikonen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 694 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20200224/e19f6b46/attachment.sig>


More information about the Gnupg-users mailing list