OpenSSL configuration examples
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.

createca.sh 573B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. set -e
  3. usage() {
  4. echo "Usage: $1 <cabasedir> <ca.key.pem> <ca.crt.pem>"
  5. exit 1
  6. }
  7. if [ $# -lt 3 ]; then
  8. usage $0
  9. fi
  10. if [ ! -f "$2" ]; then
  11. echo "$2 is no file."
  12. usage $0
  13. fi
  14. REQCONF="$2"
  15. if [ ! -f "$3" ]; then
  16. echo "$2 is no file."
  17. usage $0
  18. fi
  19. CACONF="$3"
  20. if [ -d "$1" ]; then
  21. echo "$1 does already exist. Please specify a new directory."
  22. usage $0
  23. fi
  24. CADIR="$1"
  25. mkdir -p "${CADIR}"/{certs,crl,newcerts,private}
  26. cp "$2" "${CADIR}/private/ca.key.pem"
  27. cp "$3" "${CADIR}/ca.crt.pem"
  28. echo "01" > "${CADIR}/serial"
  29. touch "${CADIR}/index.txt"