Page History
Table of Contents |
---|
Introduction
SSL/TLS Certificates are used to secure the HTTP connection connections between JS7 products, for example example JS7 - JOC Cockpit HTTPS Connections.
Users have a choice to use Private CA-signed Certificates and selfPublic 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 known and trusted Certificate Authority (CA) that validates the domain owner. Self-signed Certificates They are not created by the user and are not related to a known CAusers 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.
The article explains how to create self-signed Certificates by Examples in the article make use of OpenSSL 1.1.1k FIPS 25 Mar 2021 and JS7 Release 2.7.2. OpenSSL The utility ships with Linux & other Unix OS and is available for Windows. The examples are focused on Unix. .
The article suggests the following steps for creation of Private CA-signed Certificates:
- Seting up the Private CA
- Creating Private Key and Certificate Signing Request (CSR)
- Self-signing the CA Certificate
- Creating SSL/TLS Certificates
- Creating Private Key and Certificate Signing Request (CSR)
- Creating and signing Certificate
Setting up the Private CA
Anchor | ||||
---|---|---|---|---|
|
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 key_name
environment variable with a name of their choice that is used when creating related files.
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# 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}" |
Explanation:
- Users should adjust the
ca_key_name
environment variable specifying a value that matches the purpose such asroot-ca
for a Root CA Certificate. - Private Key
- Choice of algorithm such as
secp256k1
,secp384r1
depends on support by the Java version used with JS7.
- Choice of algorithm such as
- Certificare Signing Request
- The hash algorithm such as
-sha256, -sha512
can be freely chosen. - The
-subj
option specifies the Distinguished Name used for the subject of the CSR and resulting Certificate.- The Distinguished Name is a unique identifier frequently using the hierarchy of Country
C
, StateST
, LocationL
, OrganizationO
, Organizational UnitOU
and Common NameCN
. - For the Private Root CA Certificate the subject and issuer properties of the CSR/Certificate are the same. The minimum requirement is to specify the Common Name
CN=<name>
where<name>
can freely be chosen. - For Private CA-signed Certificates the subject property holds the Certificate's Distinguished Name and the issuer property holds the Private CA Certificate's Distinguished Name using different values.
- The Distinguished Name is a unique identifier frequently using the hierarchy of Country
- The hash algorithm such as
- The following files will be created with this step:
- The
root-ca.key
file will hold the Private Key. - The
root-ca.csr
file will hold the Certificate Signing Request.
- The
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names
key_name=root-ca
# Create Private Key and Certificate Signing Request (CSR)
openssl req -new -newkey rsa:4096 -sha256 -nodes \
-keyout ${key_name}.key \
-out ${key_name}.csr \
-subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}" |
Explanation:
- In the example the Private Key is created using the specified key size
4096
. - Choice of algorithm such as
secp256k1
,secp384r1
depends on support by the Java version used with JS7. - For use of the
-subj
option see Using ECDSA Encryption. - The following files will be created with this step:
- The
root-ca.key
file will hold the Private Key. - The
root-ca.csr
file will hold the Certificate Signing Request.
- The
Anchor | ||||
---|---|---|---|---|
|
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.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# 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") |
Explanation:
- The SHA option such as
-sha256, -sha384, -sha512
can be freely chosen. - The
-days
option specifies the validity period of the CA Certificate that should be longer than the validity period of individual certificates signed by the CA later on. - The
-signkey
option specifies the location of the Private Key file created from the previous step. - The
-in
option specifies the location of the Certificate Signing Request file created from the previous step. - The
-out
option specifies the location of the resulting Certificate file. - The
-extfile
option specifies the Basic ConstraintCA:TRUE
which is required for a CA Certificate. Key Usage is limited to signing certificates. - The following files will be created with this step:
- The
root-ca.crt
file will hold the CA Certificate.
- The
Creating SSL/TLS Certificates
Creating Private Key and Certificate Signing Request
Creating and signing Certificate
------------------------------------
Anchor | ||||
---|---|---|---|---|
|
The first step includes to create the root-ca.key
private key file and the root-ca.crt
self-signed Certificate file for the Root CA both in PEM format. This step is performed just once.
...
Country Name
: a 2 letter country code is expected as stated for example with https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2State or Province Name
: the name of a state is expectedLocality Name
: the name of a city is expectedOrganization Name
: arbitrary input is allowedOrganizational Unit Name
: arbitrary input is allowedCommon Name
: an arbitrary name can be chosen as the name of the Root CAEmail Address
: empty input is allowed
Anchor | ||||
---|---|---|---|---|
|
For a given server next steps includes to create a private key and Certificate Signing Request (CSR). The resulting server certificate will be signed.
...
Code Block | ||||
---|---|---|---|---|
| ||||
[ req ] prompt = no distinguished_name = standard dn [ standard dn ] commonName = somehost countryName = DE localityName = Berlin organizationName = SOS organizationalUnitName = JS7 stateOrProvinceName = Berlin [ standard exts ] extendedKeyUsage = serverAuth,clientAuth |
Resources
Shell Scripts
As an alternative to running OpenSSL commands in an interactive shell a few scripts are provided that perform this task.
...
The sub-directories certs
, csr
and private
will be created from the below scripts should they not exist.
Creating the Root CA Certificate
Download: create_root_ca.sh
...
--days
- The lifetime of the certificate is specified by the number of days (default: 5475, matching approx. 15 years).
- Consider that server certificates have to be renewed if the Root CA Certificate expires.
Creating a Server Certificate
Download: create_certificate.sh
...
--dns
- The DNS hostname of the server that should be assigned the certificate. A server can be assigned more than one DNS hostname, for example the FQDN can extend the hostname. Only DNS hostnames that are added to the certificate can be used later on to establish secure HTTPS connections.
--days
- The lifetime of the certificate is specified by the number of days (default: 5475, matching approx. 15 years).
Links
...