Creating self-signed CA and certificates

Written by

in

Create CA secret key

openssl genrsa -aes256 -out ca.key 2048

Create CA cert

openssl req -new -x509 -nodes -days 365000 -key ca.key -out ca.crt

Create secret key and certificate request

openssl req -newkey rsa:2048 -days 365000 -nodes -keyout server.key -out server.csr

To have alternative hostname

openssl req -newkey rsa:2048 -days 365000 -nodes -keyout server.key -out server.csr -addext "subjectAltName=DNS:example.com,DNS:www.example.com"

Complete certificate request

openssl x509 -req -in server.csr -days 365000 -CA ca.crt -CAkey ca.key -copy_extensions copy -out server.crt

Create more requests with existing server key (adding new alt name for example)

openssl req -key server.key -out server.csr -addext "subjectAltName=DNS:example.com,DNS:www.example.com,DNS:manage.example.com"

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.