Skip to content

Instantly share code, notes, and snippets.

@georgechang
Created July 18, 2021 19:20
Show Gist options
  • Save georgechang/a8d0592bdb839f2cdb4bf3f0045e91d8 to your computer and use it in GitHub Desktop.
Save georgechang/a8d0592bdb839f2cdb4bf3f0045e91d8 to your computer and use it in GitHub Desktop.
Create client cert with openssl
# create new client key
openssl genrsa -out dhclient.key 2048
# create CSR from key
openssl req -new -key .\client.key -out client.csr
# create .key file from cert
openssl pkcs12 -in cert.p12 -nocerts -out cert.key -nodes
# create .pem file from cert
openssl pkcs12 -in cert.p12 -nokeys -clcerts -out cert.pem
# fulfill CSR
openssl x509 -req -in client.csr -CA cert.pem -CAkey cert.key -CAcreateserial -out client.pem -extfile client.ext -days 365 -sha256
# convert back into .p12
openssl pkcs12 -export -inkey client.key -in client.pem -out client.p12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment