openssl req -new \
-newkey rsa:2048 \
-nodes \
-x509 \
-subj "/C=US/ST=GD/L=SZ/O=Startup, Inc./CN=domain.com/emailAddress=info@dmoain.com" \
-addext "subjectAltName = DNS:domain.com" \
-text \
-noout
CSR first
openssl req -new \
-newkey rsa:2048 \
-nodes \
-subj "/C=US/ST=GD/L=SZ/O=Startup, Inc./CN=domain.com/emailAddress=info@dmoain.com" \
-addext "subjectAltName = DNS:domain.com, DNS:*.domain.com" \
-keyout domain.key \
-out domain.csr
.
openssl x509 -req \
-in domain.csr \
-days 365 \
-signkey domain.key \
-out domain.crt
Since this certificate is not signed by a trusted CA, we need to install it on our system and tweak its trust parameters as described in the same article.
openssl x509 -req -CAcreateserial -days 365 \
-CA domain.crt \
-CAkey domain.key \
-out domain.crt \
-in domain.csr
go run server.go
go run client.go
curl --cacert ./certs/domain.crt https://domain.com:9000