Michal Čihař - GnuPG path grabbing

GnuPG path grabbing

Many times I needed "intelligent" way to grab key path from my key (and others I somehow trust for signing purposes) to other random key that gets to me.

Receiving keys for all signatures is quite expensive operation and you soon end with most of PGP keys on the world in your database. The best seems to fetch only needed keys. You can find path using PGP pathfinder & key statistics by Henk P. Penning. It's extremely useful site, where you can find many information about PGP keys.

So the logical step seems to be to write down script which will grab needed keys:

#!/bin/sh

if [ "$#" -lt 1 -o "$#" -gt 2 ] ; then
    echo usage `basename $0` ID [gpgparam]
    exit 1
fi

url=http://www.cs.uu.nl/people/henkp/henkp/pgp/pathfinder/mk_path.cgi

(
links -dump "$url?FROM=36E75604&TO=$1"
links -dump "$url?FROM=B3B2A12C&TO=$1"
links -dump "$url?FROM=65D0FD58&TO=$1"
) | grep -o '[0-9A-F]\{8\}'  | sort -u | xargs gpg --recv-keys --no-auto-check-trustdb $2

gpg --check-trustdb $2

And special bonus for Sylpheed-Claws users. Here is action to call above script:

ID=`gpg --verify %p /dev/null 2>&1 | \
grep "key ID" | tr -d "[:space:]" | \
tail -c8`;echo "==== Fetching $ID ===="; \
~/bin/gpg_get_path $ID --no-tty

New Comment

You can not add new comments to old blog posts.