summaryrefslogtreecommitdiff
path: root/src/subcommands/ma/remove-certifier
blob: 2100b2d9ea8a5335db598faddaaa1234dd888422 (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. remove_certifier() {
  13. local keyID
  14. local fingerprint
  15. keyID="$1"
  16. if [ -z "$keyID" ] ; then
  17. failure "You must specify the key ID of a key to remove."
  18. fi
  19. if gpg_sphere "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-key 0x${keyID}!" ; then
  20. read -p "Really remove above listed identity certifier? (y/N) " OK; OK=${OK:-N}
  21. if [ "${OK/y/Y}" != 'Y' ] ; then
  22. failure "Identity certifier not removed."
  23. fi
  24. else
  25. failure
  26. fi
  27. # delete the requested key
  28. if gpg_sphere "--delete-key --batch --yes 0x${keyID}!" ; then
  29. # delete key from host keyring as well
  30. gpg_core --delete-key --batch --yes "0x${keyID}!"
  31. # update the trustdb for the authentication keyring
  32. gpg_sphere "--check-trustdb"
  33. echo
  34. echo "Identity certifier removed."
  35. else
  36. failure "Problem removing identity certifier."
  37. fi
  38. }