summaryrefslogtreecommitdiff
path: root/src/subcommands/ma/remove-certifier
blob: a4eaf548ad5c872810eeaaccd2359dccd553a203 (plain)
  1. #!/usr/bin/env bash
  2. # Monkeysphere authentication remove-certifier subcommand
  3. #
  4. # The monkeysphere scripts are written by:
  5. # Jameson Rollins <jrollins@fifthhorseman.net>
  6. # Jamie McClelland <jm@mayfirst.org>
  7. # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
  8. #
  9. # They are Copyright 2008, and are all released under the GPL, version 3
  10. # or later.
  11. # delete a certifiers key from the host keyring
  12. local keyID
  13. local fingerprint
  14. keyID="$1"
  15. if [ -z "$keyID" ] ; then
  16. failure "You must specify the key ID of a key to remove."
  17. fi
  18. if gpg_authentication "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-key 0x${keyID}!" ; then
  19. read -p "Really remove above listed identity certifier? (y/N) " OK; OK=${OK:-N}
  20. if [ "${OK/y/Y}" != 'Y' ] ; then
  21. failure "Identity certifier not removed."
  22. fi
  23. else
  24. failure
  25. fi
  26. # delete the requested key
  27. if gpg_authentication "--delete-key --batch --yes 0x${keyID}!" ; then
  28. # delete key from host keyring as well
  29. gpg_host --delete-key --batch --yes "0x${keyID}!"
  30. # update the trustdb for the authentication keyring
  31. gpg_authentication "--check-trustdb"
  32. echo
  33. echo "Identity certifier removed."
  34. else
  35. failure "Problem removing identity certifier."
  36. fi