Page History
...
Self-signed Certificates and CA Certificates are deployed to the <data>/config/private/trusted-x509-keys
directory of Controller and Agent instances.
...
The step to create a Private Key and Certificate Signing Request is the same for use of self-signed Certificates and CA-signed Certificates. 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 a shell and replace the value of the key_name
environment variable with a name of their choice that is used when creating related files.
...
The article suggests the following steps for creation of both Self-signed Certificates and CA-signed Certificates:
- Create Private Key
- Create Certificate Signing Request (CSR)
- Create and sign Certificate
The article explains from scratch how to create Signing Certificates for use with JS7. Users who operate their own Certificate Authority might find different approaches and different responsibilities for the indicated steps. There's more than one way how to do it.
Examples in the article make use of OpenSSL 1.1.1k FIPS 25 Mar 2021 and JS7 Release 2.7.2.
Anchor | ||||
---|---|---|---|---|
|
The steps to create a Private Key and Certificate Signing Request are the same for use of self-signed Certificates and CA-signed Certificates. 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
key_name=signing
# Create Private Key
openssl |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names
key_name=signing
# Create Private Key
openssl ecparam -genkey -name secp384r1 -out "${key_name}".key
# Create Certificate Signing Request (CSR)
openssl req -new -sha512 -nodes \
-key "${key_name}".key \
-out "${key_name}".csr \
-subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}" |
...
- Private Key
- Choice of algorithm such as
secp256k1
,secp384r1
is up to the user depends on support by the Java version used with JS7.
- Choice of algorithm such as
- Certificare Signing Request
- The SHA option hash algorithm such as
-sha256, -sha384
must match the algorithmsha512
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 self-signed Certificates 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 CA-signed Certificates the subject property holds the Certificate's Distinguished Name and the issuer property holds the CA Certificate's Distinguished Name. Both Distinguished Names should match except for the Common Name
CN
.
- The Distinguished Name is a unique identifier frequently using the hierarchy of Country
- The SHA option hash algorithm such as
- The following files will be created with this step:
- The
<key_name>
.key
file will hold the Private Key. - The
<key_name>
.csr
file will hold the Certificate Signing Request.
- The
...
- In the example the Private Key is created using the specified key size
4096
. - The SHA option Choice of algorithm such as
-sha256, -sha384, -sha512
must match the algorithmsecp256k1
,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
<key_name>
.key
file will hold the Private Key. - The
<key_name>
.csr
file will hold the Certificate Signing Request.
- The
...
- The SHA option such as
-sha256, -sha384, -sha512
must should preferably match the value of the option used when creating the Private Key/ Certificate Signing Request. - The
-days
argument optionally specifies the validity period of the resulting Certificate. - 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 a number of extensions recommended for use with Signing Certificates. - The following files will be created with this step:
- The
<key_name>
.crt
file will hold the self-signed Certificate.
- The
...
The steps to create the CA Private Key and CA Certificate are similar to Creating the Private Key and Certificate Signing Request for self-signed Certificates.
Anchor | ||||
---|---|---|---|---|
|
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names ca_key_name=signing-ca # Create Private Key and Certificate Signing Request (CSR) openssl reqecparam -newgenkey -newkeyname ecsecp384r1 -pkeyopt ec_paramgen_curve:secp256k1 -sha256out "${ca_key_name}".key # Create Certificate Signing Request (CSR) openssl req -new -sha512 -nodes \ -keyoutkey "${ca_key_name}".key \ -out "${ca_key_name}".csr \ -subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${ca_key_name}" oder: # 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/ |
Explanation:
- Explanations are the same as from Creating Private Key and Certificate Signing Request for self-signed Certificates.
- Users can choose Using ECDSA Encryption or Using RSA Encryption.
Anchor | ||||
---|---|---|---|---|
|
Steps include to create the signing-ca.crt
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=signing-ca # Create Certificate openssl x509 -req -days 7305 \ -signkey "O=SOS/OU=IT/CN=${ca_key_name}" |
Explanation:
- Explanations are the same as for Creating Private Key and Certificate Signing Request.
- Users can choose Using ECDSA Encryption or Using RSA Encryption.
...
Steps include to create the signing-ca.crt
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=signing-ca
# Create Certificate
openssl x509 -req -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:
- Explanations are similar to Creating self-signed Certificates with a few exceptions.
- The
-days
option specifying the validity period of the CA Certificate should be longer than the validity period of individual certificates. - The
-extfile
option specifies the Basic ConstraintCA:TRUE
which is required for a CA Certificate. Key Usage is limited to signing certificates.
- The
- The following files will be created with this step:
- The
signing-ca.crt
file will hold the CA Certificate.
- The
The CA Certificate must be copied to the <data>/config/private/trusted-x509-keys
directory of Controller and Agent instances.
...
.key \
-in "${ca_key_name}".csr \
-out "${ca_key_name}".crt \
-extfile <(printf "basicConstraints=CA:TRUE\nkeyUsage=critical,nonRepudiation,keyCertSign,cRLSign\n") |
Explanation:
- Explanations are similar to Creating self-signed Certificates with a few exceptions.
- The
-days
option specifying the validity period of the CA Certificate should be longer than the validity period of individual certificates. - The
-extfile
option specifies the Basic ConstraintCA:TRUE
which is required for a CA Certificate. Key Usage is limited to signing certificates.
- The
- The following files will be created with this step:
- The
signing-ca.crt
file will hold the CA Certificate.
- The
The CA Certificate must be copied to the <data>/config/private/trusted-x509-keys
directory of Controller and Agent instances.
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Steps include to create the signing.key
Private Key file and signing.csr
Certificate Signing Request file both in PEM format.
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.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names
key_name=signing
# Create Private Key
openssl ecparam -genkey -name secp384r1 -out "${key_name}".key
# Create Certificate Signing Request (CSR)
openssl req -new -sha512 -nodes \
-key "${key_name}".key \
-out "${key_name}".csr \
-subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}" |
Explanation:
- Explanations are the same as with Creating Private Key and Certificate Signing Request for self-signed Certificates.
- Users can choose Using ECDSA Encryption or Using RSA Encryption.
Anchor | ||||
---|---|---|---|---|
|
Steps include to create the signing.crt
CA-signed Certificate file
...
Steps include to create the signing.key
Private Key file and signing.csr
Certificate Signing Request file both in PEM format.
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.:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names key_name=signing # Create Private KeyCertificate openssl ecparamx509 -genkeyreq -name secp384r1sha512 -outdays 3652 \ -in "${key_name}".key # Create Certificate Signing Request (CSR) openssl req -new -sha512 -nodescsr \ -CA signing-ca.crt \ -CAkey signing-ca.key \ -key "${key_name}".keyCAcreateserial \ -out "${key_name}".csrcrt \ -subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}"extfile <(printf '\nkeyUsage=critical,nonRepudiation,digitalSignature\nextendedKeyUsage=critical,codeSigning\n') |
Explanation:
- Explanations are the same as for Creating Private Key and Certificate Signing Request.
- Users can choose Using ECDSA Encryption or Using RSA Encryption.
...
Steps include to create the signing.crt
CA-signed Certificate file in PEM format.
Users can run the following commands from a shell and replace the value of the 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
key_name=signing
# Create Certificate
openssl x509 -req -sha512 -days 3652 \
-in "${key_name}".csr \
-CA signing-ca.crt \
-CAkey signing-ca.key \
-CAcreateserial \
-out "${key_name}".crt \
-extfile <(printf '\nkeyUsage=critical,nonRepudiation,digitalSignature\nextendedKeyUsage=critical,codeSigning\n') |
Explanation:
- Explanations are similar to Creating self-signed Certificates with a few exceptions:
- The
-days
option specifying the validity period of the Signing Certificate should be shorter than the validity period of the CA Certificate. - The
-in
option specifies the location of the Certificate Signing Request. - The
-CA
option specifies the location of the CA Certificate file. - The
-CAkey
option specifies the location of the CA Private Key file. - The
-extfile
option specifies the Key Usage being limited to code signing.
- The
- The following files will be created with this step:
- The
signing.crt
file will hold the Signing Certificate..
- The
The Signing Certificate file does not require to be deployed to Controller and Agent instances. Instead, the CA Certificate file is deployed to Controller and Agent instances.
---------------------------------------------------------------------------------------------
Not Used
---------------------------------------------------------------------------------------------
...
Users have an option ot use ECDSA or RSA for the encryption type.
Users can run the following commands from a bash shell and replace the value of the key_name
environment variable with a name of their choice that is used when creating related files.
Using ECDSA Encryption
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names
key_name=signing
# Step 1 - Create Private Key
# openssl ecparam -name secp256k1 -genkey -noout -out "${key_name}".key
# Step 2 - Generate and sign Certificate
# openssl req -new -x509 -sha256 -key "${key_name}".key -out "${key_name}".crt -days 5475
# Step 1: Create Private Key and Certificate Signing Request (CSR)
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:secp256k1 -sha256 -nodes \
-keyout "${key_name}".key \
-out "${key_name}".csr \
-subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}"
# Step 2: Create Certificate
openssl x509 -req -days 5475 \
-signkey "${key_name}".key \
-in "${key_name}".csr \
-out "${key_name}".crt \
-extfile <(printf "basicConstraints=CA:FALSE\nkeyUsage=critical,nonRepudiation,digitalSignature\nextendedKeyUsage=critical,codeSigning\n") |
Explanation:
- Step 1: Create Private Key and Certificate Signing Request (CSR)
- Choice of algorithm such as
secp256k1
,secp384r1
is up to the user. - The SHA option such as
-sha256, -sha384
must match the algorithm. - The
-subj
option specifies the distinguished name used for the subject and issuer of the CSR and certificate. - The following files will be created with this step:
- The
<key_name>
.key
file will hold the Private Key. - The
<key_name>
.csr
file will hold the Certificate Signing Request.
- The
- Choice of algorithm such as
- Step 2: Create Certificate
- The
-days
argument optionally specifies the validity period of the Certificate. - The following files will be created with this step:
- The
<key_name>
.crt
file will hold the self-signed Certificate.
- The
- The
Using RSA Encryption
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Specify key name used for file names
key_name=signing
# Step 1: 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}"
# Step 2: Create Certificate
openssl x509 -req -days 5475 \
-signkey "${key_name}".key \
-in "${key_name}".csr \
-out "${key_name}".crt \
-extfile <(printf "keyUsage=critical,nonRepudiation,digitalSignature\nextendedKeyUsage=critical,codeSigning\n") |
Explanation:
- Step 1: Create Private Key and Certificate Signing Request (CSR)
- In the example the Private Key is created using the specified key size
4096
. - The following files will be created with this step:
- The
<key_name>
.key
file will hold the Private Key. - The
<key_name>
.csr
file will hold the Certificate Signing Request.
- The
- In the example the Private Key is created using the specified key size
- Step 2: Create Certificate
- The Certificate is created with the
-days
argument optionally specified for the validity period of the Certificate. - The following files will be created with this step:
- The
<key_name>
.crt
file will hold the self-signed Certificate.
- The
- The Certificate is created with the
...
Steps include to create the signing-ca.key
Private Key file and signing-ca.crt
self-signed Certificate file for the CA both in PEM format.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Step 1: Generate Certificate Authority (CA) Private Key
openssl ecparam -genkey -name secp256k1 -noout -out signing-ca.key
# Step 2: Generate CA Certificate
openssl req -new -x509 -sha256 -days 5475 -key signing-ca.key -out signing-ca.crt
# You are about to be asked to enter information that will be incorporated
# into your certificate request.
# What you are about to enter is what is called a Distinguished Name or a DN.
# There are quite a few fields but you can leave some blank
# For some fields there will be a default value,
# If you enter '.', the field will be left blank.
# -----
# Country Name (2 letter code) [XX]:DE
# State or Province Name (full name) []:Berlin
# Locality Name (eg, city) [Default City]:Berlin
# Organization Name (eg, company) [Default Company Ltd]:SOS
# Organizational Unit Name (eg, section) []:JS7
# Common Name (eg, your name or your server's hostname) []:JS7 Deployment CA
# Email Address []:
# Specify key name used for file names
ca_key_name=signing-ca
# Step 1: Create Private Key and Certificate Signing Request (CSR)
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:secp256k1 -sha256 -nodes \
-keyout "${ca_key_name}".key \
-out "${ca_key_name}".csr \
-subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${ca_key_name}"
# Step 2: Create Certificate
openssl x509 -req -days 5475 \
-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") |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Step 1: Create Certificate Authority (CA) Private Key using passphrase
openssl ecparam -genkey -name secp256k1 | openssl ec -aes256 -passout pass:"jobscheduler" -out signing-ca.key
# Step 2: Create CA Certificate
openssl req -new -x509 -sha256 -days 5475 -key signing-ca.key -passin pass:"jobscheduler" -out signing-ca.crt |
Explanation:
- Step 1: The Private Key is created.
- Choice of algorithm such as
secp256k1
,secp384r1
is up to the user. - The SHA option such as
-sha256, -sha384
must match the algorithm. - The
signing-ca.key
file will hold the Private Key.
- Choice of algorithm such as
- Step 2: The CA Certificate is created
- As a response to the command the OpenSSL utility prompts for a number of specifications for the Distinguished Name, i.e. the unique name of the CA Certificate:
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 CAEmail Address
: empty input is allowed
- The
signing-ca.crt
file will hold the Signing Certificate..
- As a response to the command the OpenSSL utility prompts for a number of specifications for the Distinguished Name, i.e. the unique name of the CA Certificate:
...
For a Signing Certificate the steps include to create the Private Key and Certificate Signing Request (CSR). The resulting Signing Certificate will be signed by the CA.\nnnnn
Users can run the following commands from a bash shell and replace the value of the 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
key_name=signing
# Step 1 - Create Private Key and Certificate Signing Request (CSR)
openssl req -new -sha256 -config <(cat openssl-cert.config <(printf "\nkeyUsage=critical,nonRepudiation,digitalSignature\nextendedKeyUsage=critical,codeSigning\n")) \
-nodes -keyout "${key_name}".key -out "${key_name}".csr
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:secp256k1 -sha256 -nodes \
-keyout "${key_name}".key \
-out "${key_name}".csr \
-subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}"
# Step 2 - Create the Signing Certificate
openssl x509 -req \
-in "${key_name}".csr \
-CA signing-ca.crt \
-CAkey signing-ca.key \
-CAcreateserial \
-out "${key_name}".crt -days 7300 \
-extfile <(printf '\nkeyUsage=critical,nonRepudiation,digitalSignature\nextendedKeyUsage=critical,codeSigning\n')
|
Explanation:
- Step 1: Create Private Key and Certificate Signing Request
- The Certificate Signing Request is created for the Key Usage and Extended Key Usage as indicated.
- The following files will be created:
<key_name>
.key
: the Private Key<key_name>
.csr
: the Certificate Signing Request
- Step 2: The Signing Certificate is created.
- The following files will be created:
<key_name>
.crt
: the Signing Certificate
- The following files will be created:
In order to run the script successfully the following openssl-cert.config
file has to be present. To create a Signing Certificate the CommonName
attribute has to be adjusted.
...
title | OpenSSL configuration file openssl-cert.config |
---|---|
linenumbers | true |
...
- similar to Creating self-signed Certificates with a few exceptions:
- The
-days
option specifying the validity period of the Signing Certificate should indicate a shorter period than the validity period of the CA Certificate. - The
-in
option specifies the location of the Certificate Signing Request. - The
-CA
option specifies the location of the CA Certificate file. - The
-CAkey
option specifies the location of the CA Private Key file. - The
-extfile
option specifies the Key Usage being limited to code signing.
- The
- The following files will be created with this step:
- The
signing.crt
file will hold the Signing Certificate..
- The
The Signing Certificate file does not require to be deployed to Controller and Agent instances. Instead, the CA Certificate file is deployed to Controller and Agent instances.