gen-pubcert.sh 357 B

123456789101112131415161718
  1. #!/bin/bash
  2. if [[ $# -ne 2 ]]; then
  3. echo "Usage: $0 priv-key out-file"
  4. exit 1
  5. fi
  6. openssl req -new -key "$1" -days 36500 -utf8 -nodes -batch \
  7. -x509 -outform PEM -out "$2" \
  8. -config <(cat <<-EOF
  9. [ req ]
  10. distinguished_name = req_distinguished_name
  11. string_mask = utf8only
  12. prompt = no
  13. [ req_distinguished_name ]
  14. commonName = sforshee
  15. EOF
  16. )