You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

revoke-full 920B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. # revoke a certificate, regenerate CRL,
  3. # and verify revocation
  4. CRL="crl.pem"
  5. RT="revoke-test.pem"
  6. if [ $# -ne 1 ]; then
  7. echo "usage: revoke-full <cert-name-base>";
  8. exit 1
  9. fi
  10. if [ "$KEY_DIR" ]; then
  11. cd "$KEY_DIR"
  12. rm -f "$RT"
  13. # set defaults
  14. export KEY_CN=""
  15. export KEY_OU=""
  16. export KEY_NAME=""
  17. # revoke key and generate a new CRL
  18. $OPENSSL ca -revoke "$1.crt" -config "$KEY_CONFIG"
  19. # generate a new CRL -- try to be compatible with
  20. # intermediate PKIs
  21. $OPENSSL ca -gencrl -out "$CRL" -config "$KEY_CONFIG"
  22. if [ -e export-ca.crt ]; then
  23. cat export-ca.crt "$CRL" >"$RT"
  24. else
  25. cat ca.crt "$CRL" >"$RT"
  26. fi
  27. # verify the revocation
  28. $OPENSSL verify -CAfile "$RT" -crl_check "$1.crt"
  29. else
  30. echo 'Please source the vars script first (i.e. "source ./vars")'
  31. echo 'Make sure you have edited it to reflect your configuration.'
  32. fi