Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created August 29, 2024 04:40
Show Gist options
  • Save lantrix/265b35cb59ae4c9efc48ef992c8eabcc to your computer and use it in GitHub Desktop.
Save lantrix/265b35cb59ae4c9efc48ef992c8eabcc to your computer and use it in GitHub Desktop.
# List keys
gpg --list-secret-keys |egrep -v 'sec|uid|ssb'
Populate list
keys="A1B2C3D4E5F67890A1B2C3D4E5F67890A1B2C3D4 FEDCBA9876543210FEDCBA9876543210FEDCBA98 1234ABCD5678EFGH1234ABCD5678EFGH1234ABCD"
for key in $keys; do echo "Processing $key"; gpg -k $key | grep uid; done
# Export
for key in $keys; do
gpg --export --armor ${key} > ${key}.pub.asc
gpg --export-secret-keys --armor ${key} > ${key}.priv.asc
gpg --export-secret-subkeys --armor ${key} > ${key}.sub_priv.asc
done
gpg --export-ownertrust > ownertrust.txt
# Import
for key in $keys; do
gpg --import ${key}.pub.asc
gpg --import ${key}.priv.asc
gpg --import ${key}.sub_priv.asc
done
gpg --import-ownertrust ownertrust.txt
# Ultimate trust - type trust, then 5 (which means "ultimate trust")
for key in $keys; do
gpg --edit-key ${key}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment