How to Generate SSL Certificates
There is lots to know about SSL and generating secure certificates. If you only want to know the commands to get a certificate follow this guide.
Save this configuration file as cert.conf
.
Fill in your own values for the CN
(Common Name), emailAddress, O
(Organisation), L
(Location) and C
(Country). Don’t forget to change the PASSPHRASE
.
Fill in the subjectAltName
for all the domains you want in this certificate.
RSA key generation
This creates two files:
- rsa.key: Your private key, don’t give this to anyone
- rsa.csr: A Certificate Signing Request. Upload this file to your SSL seller. You will receive a signed certificate.
Self Signing
If you want to self sign the request for use this:
This gives you rsa.crt, your public key. This certificate is valid for a year.
Elliptic Curve
Do you want a more modern key? Elliptic Curve cryptography has smaller key sizes compared to RSA. A 256-bit public key is as secure as a 3072-bit RSA public key.
This creates three files:
- ec.param: Specifies the elliptic curve used
- ec.key: The private key
- ec.csr: A Certificate Signing Request. Upload this file to your SSL seller.
Self Signing
If you want to self sign the request for use this:
This gives you ec.crt, your public key. This certificate is valid for a year.
The OpenSSL Cookbook
If you want to know more, I highly recommend this book: OpenSSL Cookbook