OpenSSL Certificate (Version 3) with Subject Alternative Name

Here is the simple steps for you

While generating the CSR you should use -config and -extensions
and while generating certificate you should use -extfile and -extensions

Here is the example:

openssl req -new -nodes -keyout test.key  -out test.csr -days 3650 -subj "/C=US/ST=SCA/L=SCA/O=Oracle/OU=Java/CN=test cert" -config /etc/pki/tls/openssl.cnf -extensions v3_req
openssl x509 -req -days 3650 -in test.csr -CA cacert.pem -CAkey rootCA.key -CAcreateserial -out test.pem -extfile /etc/pki/tls/openssl.cnf  -extensions v3_req

hope this helps

Leave a Comment