Introduction
SSL/TLS Certificates are used to secure HTTP connections between JS7 products, for example JS7 - JOC Cockpit HTTPS Connections.
Users have a choice to use Private CA-signed Certificates and Public CA-signed Certificates:
- Private CA-signed Certificates are issued by users who operate their own Private Certificate Authority (CA).
- Public CA-signed Certificates are issued by a trusted Certificate Authority (CA) that validates the domain owner. They are not created by users but are purchased from the trusted CA and therefore are not considered by the article.
There is no difference concerning the type of X.509 certificates, the usage for Server Authentication / Client Authentication, or the security of connections.
Examples in the article make use of OpenSSL 1.1.1k FIPS 25 Mar 2021 and JS7 Release 2.7.2. OpenSSL ships with Linux & other Unix OS and is available for Windows. The examples are focused on Unix.
Setting up the Private CA
Creating the Private Key and Certificate Signing Request
Users have the option to use ECDSA or RSA for the encryption type applied to the Private Key.
Users can run the following commands from the shell and replace the value of the ca_key_name
environment variable with a name of their choice that is used when creating related files.
Using ECDSA Encryption
# Specify key name used for file names ca_key_name=root-ca # Create Private Key openssl ecparam -genkey -name secp384r1 -out ${ca_key_name}.key # Create Certificate Signing Request (CSR) openssl req -new -sha512 -nodes \ -key ${ca_key_name}.key \ -out ${ca_key_name}.csr \ -subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${ca_key_name}"
Using RSA Encryption
Creating the CA Certificate
Steps include to create the root-ca.crt
Private CA-signed Certificate file in PEM format.
Users can run the following commands from the shell and replace the value of the ca_key_name
environment variable with a name of their choice that is used when creating related files.
# Specify key name used for file names ca_key_name=root-ca # Create Certificate openssl x509 -req -sha512 -days 7305 \ -signkey ${ca_key_name}.key \ -in ${ca_key_name}.csr \ -out ${ca_key_name}.crt \ -extfile <(printf "basicConstraints=CA:TRUE\nkeyUsage=critical,nonRepudiation,keyCertSign,cRLSign\n")
Creating SSL/TLS Server Certificates
For a given server next steps includes to create the Private Key and Certificate Signing Request (CSR). The resulting Server Certificate will be signed by the Private CA.
This step is performed for each Server Certificate that should be created.
Users can run the following commands from the shell and replace the value of the server_name
environment variable with a name of their choice that is used when creating related files.
Creating Private Key and Certificate Signing Request
Using ECDSA Encryption
# Specify key name used for file names server_name=myhost # Create Private Key openssl ecparam -genkey -name secp384r1 -out ${server_name}.key # Create Certificate Signing Request openssl req -new -sha512 -nodes \ -key ${server_name}.key \ -out ${server_name}.csr \ -subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${server_name}"
Using RSA Encryption
Creating and signing Certificate
# Specify server for which the certificate should be created server_name=myhost # Create and sign Server Certificate openssl x509 -req -sha512 -days 3652 \ -in ${server_name}.csr \ -CA root-ca.crt \ -CAkey root-ca.key \ -CAcreateserial \ -out ${server_name}.crt \ -extfile <(printf 'subjectAltName=DNS:%s\nkeyUsage=critical,keyEncipherment,digitalSignature\nextendedKeyUsage=serverAuth,clientAuth\n' "${server_name}")
Resources
- JS7 - How to add SSL TLS Certificates to Keystore and Truststore
- JS7 - How to create X.509 Signing Certificates