Preparing certificates for a TLS server connection
To accept a TLS server connection, we will need to generate two keypairs and certificates: the server certificate and the self-signed CA certificate, which signs the server certificate. Why can’t we just generate a self-signed server certificate, a curious reader may ask? Because using a self-signed certificate as a server certificate is considered an error by most TLS clients and libraries, including the OpenSSL library. Another question you may have is: why can’t we reuse certificates from the OS certificate store for our TLS server? Because we don’t possess private keys for those certificates.
As in Chapter 8, X.509 Certificates and PKI, we will use the openssl req
and openssl x509
subcommands for keypairs and certificate generation. But, this time, we will use combined generation commands to demonstrate them too.
We have to generate the CA certificate first. This time, we will use a command that combines...