Skip to content

Instantly share code, notes, and snippets.

@runcom
Created February 5, 2020 08:58
Show Gist options
  • Save runcom/630bc3993b7291c0383cb5346f80e68a to your computer and use it in GitHub Desktop.
Save runcom/630bc3993b7291c0383cb5346f80e68a to your computer and use it in GitHub Desktop.
script to sign and send sigs after a keysigning party (FOSDEM)
#!/bin/bash
set -e
GNUPGHOME=./gnupg-backup
for i in "${@:1}"
do
KEY=$i
gpg --homedir ./gnupg-backup --ask-cert-level --sign-key $KEY
gpg --homedir ./gnupg-backup --armor --export $KEY | gpg --homedir ./gnupg-backup --encrypt -r $KEY --armor --output fosdem-keysigning/$KEY-signedBy-CC5C9A81EDCAD821.asc
EMAILS=$(gpg --homedir ./gnupg-backup --with-colons --list-keys $KEY | awk -F: '$1=="uid" { print $10 }' | awk -F'<' '{ for(i = 2 ; i <= NF ; i++) { sub(/>.*/, "", $i); print $i; } } ' | xargs)
for uid in $EMAILS
do
echo "sending mail to $uid"
uuencode fosdem-keysigning/$KEY-signedBy-CC5C9A81EDCAD821.asc fosdem-keysigning/$KEY-signedBy-CC5C9A81EDCAD821.asc | mail -s "Your signed PGP key 0x$KEY" $uid
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment