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