RobotNet/certificate/gencert.sh
2025-10-15 15:15:53 +07:00

24 lines
837 B
Bash

#/bin/bash
rm -f ./*.pfx
rm -f ./*.crt
rm -f ./*.key
rm -f ./*.pem
rm -f ./*.srl
rm -f ./*.csr
#exit
openssl genrsa -out ca.key 2048
openssl req -x509 -new -nodes -key ca.key -sha256 -days 365000 -out ca.crt -subj "/CN=LocalCA"
openssl genrsa -out identityserver.key 2048
openssl req -new -key identityserver.key -out identityserver.csr -config san.cnf
openssl x509 -req -in identityserver.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out identityserver.crt -days 365000 -sha256 -extensions v3_req -extfile san.cnf
openssl pkcs12 -export -out robotnet.pfx -inkey identityserver.key -in identityserver.crt -certfile ca.crt -password pass:RobotNet@2024
openssl pkcs12 -in robotnet.pfx -out cert.pem -clcerts -nokeys -passin pass:RobotNet@2024
openssl pkcs12 -in robotnet.pfx -out key.pem -nocerts -nodes -passin pass:RobotNet@2024