This post is about generating self-signed SSL certificates with the OpenSSL and most guides would have you believe the best way to do this has three "simple" steps:
- Create a key (pair).
- Create a CSR (Certificate Signing Request) using that key.
- Sign the CSR to get your self-signed certificate.
openssl req -new -x509 -nodes -sha256 -days 4096 -verbose \
-subj /CN=example.com/ -newkey rsa:4096 \
-keyout private/example.com.key -out certs/example.com.pem
Instead of creating a CSR and then signing it, the -x509 argument tells openssl to just skip step 2 and self-sign and output a certificate directly. If you are not going to send the CSR to someone else for signing, it does not, IMNSHO, make any sense to create it in the first place.
The -newkey and -keyout arguments does away with step 1 and just creates (and saves) the key in the same command as the signing.
Further more, by supplying the common name via -subj, no interactive input is required. No other data is required for a regular certificate used for SSL.
No comments:
Post a Comment