summaryrefslogtreecommitdiff
path: root/src/share/ma/remove_certifier
blob: c7aabea88aaeabe4ccd8d683e26e41ac8c526a72 (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 from the sphere keyring
  29. # FIXME: should this be a revokation instead of a removal?
  30. if gpg_sphere "--delete-key --batch --yes 0x${keyID}!" ; then
  31. # delete key from core keyring as well
  32. gpg_core --delete-key --batch --yes "0x${keyID}!"
  33. # update the trustdb for the authentication keyring
  34. gpg_sphere "--check-trustdb"
  35. log info ""
  36. log info "Identity certifier removed."
  37. else
  38. failure "Problem removing identity certifier."
  39. fi
  40. }