-
Create a Root key:
openssl genrsa -des3 -out rootCA.key 2048
-
Create a root certificate in PEM format, using the root key:
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem
For "Common Name" set "Local Certificate".
-
Trust the rootCA.pem file as a trusted root certificate in your OS.
-
Create file: "server.csr.cnf" with this content:
[req] default_bits = 2048 prompt = no default_md = sha256 distinguished_name = dn [dn] C=US ST=RandomState L=RandomCity O=RandomOrganization OU=RandomOrganizationUnit [email protected] CN = localhost
-
Create file: "v3.ext" with this content:
authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment subjectAltName = @alt_names [alt_names] DNS.1 = localhost
-
Create a Certificate Signatire Request:
openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config server.csr.cnf
-
Create the self-signed certificate:
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile v3.ext
-
Now you can use {{server.key}} and {{server.crt}} as your localhost ssl certificate.
Last active
June 22, 2022 21:21
-
-
Save jdavidzapatab/e4accb83e3ceb59ba32e97203c2da8ce to your computer and use it in GitHub Desktop.
Create Self-Signed Localhost certificate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment