Create application file (CSR)

 

To apply for a certificate, an electronic application file is required, summarizing the necessary information that will later appear on the certificate. This file is also known as a Certificate Signing Request (CSR). It is uploaded to the certification authority as part of the actual application process.

 

Tool

 

A widely used tool for generating CSR files and key pairs is the software OpenSSL. OpenSSL is available as a package in many Linux systems and is often pre-installed as part of the base installation. OpenSSL is also available for Windows and can be installed there. It is crucial that the system on which cryptographic keys are generated is trustworthy. The private key, in particular, must be strictly protected, as it verifies the rightful owner of the certificate and if compromised could lead to identity theft.

To avoid cluttering the command line, several settings are moved to a configuration file called 'cert.conf', which must be located in the same folder. In the template on this page, simply replace the placeholders HOSTNAME and SUBDOMAIN. For example, for a wiki server operated by the data center, this would be wiki.rz.tuhh.de. Additionally, the list under alt_names needs to be adjusted.

 

Required information

 

Creating an application file requires certain information, which can be passed to OpenSSL as command-line parameters. However, to avoid cluttering the command line, many of these settings can be moved to a configuration file called 'cert.conf'. Furthermore, a configuration file created once can be reused when renewing the certificate.

 

The following block can be copied into a simple text file named cert.conf. The placeholders HOSTNAME, HOSTNAME2, and SUBDOMAIN must be adjusted accordingly. I.E. for a wiki server operated by the computer center, this would be wiki.rz.tuhh.de. Additionally, the list under alt_names must be adjusted. The server's common name is repeated in the DNS.0 entry.

 

[ req ]
prompt = no
distinguished_name = req_distinguished_name
req_extensions = req_exts

 

[ req_distinguished_name ]
countryName = DE
stateOrProvinceName = Hamburg
localityName = Hamburg
organizationName = Technische Universitaet Hamburg
commonName = HOSTNAME.SUBDOMAIN.tuhh.de

[ req_exts ]
subjectAltName = @alt_names

[ alt_names ]
DNS.0=HOSTNAME.SUBDOMAIN.tuhh.de
DNS.1=HOSTNAME.SUBDOMAIN.tu-harburg.de
DNS.2=HOSTNAME.SUBDOMAIN.tu-hamburg.de
DNS.3=HOSTNAME2.SUBDOMAIN.tuhh.de
DNS.4=HOSTNAME2.SUBDOMAIN.tu-harburg.de
DNS.5=HOSTNAME2.SUBDOMAIN.tu-hamburg.de

Alias ​​names

 

Additional aliases can be added under alt_names, numbered sequentially. In the example above, there is a second hostname. Both are registered for the TUHH domains (tuhh.de, tu.harburg.de, tu-hamburg.de).

 

Since Harica currently does NOT take into account the aliases (i.e., the extensions called 'Subject Alternative Name') from the CSR file, when using the web forms later, you will have to either manually enter the aliases again OR upload a correspondingly prepared list as a CSV file.

Following the 'cert.conf' example above, the CSV file would look simple and single-column as follows:

DNS-Name
HOSTNAME.SUBDOMAIN.tuhh.de
HOSTNAME.SUBDOMAIN.tu-harburg.de
HOSTNAME.SUBDOMAIN.tu-hamburg.de
HOSTNAME2.SUBDOMAIN.tuhh.de
HOSTNAME2.SUBDOMAIN.tu-harburg.de
HOSTNAME2.SUBDOMAIN.tu-hamburg.de

Create a CSR file with OpenSSL

In the directory where the configuration file cert.conf is stored, you can now generate a new key pair and the CSR file using the following command.

openssl req -config cert.conf -sha256 -newkey rsa:3072 -keyout pkey.pem -out csr.pem

 

The OpenSSL command contains the following parameters:

  • req
    Creates a Certificate Signing Request (CSR).
  • -config cert.conf
    File name and, if applicable, path to the configuration file.
  • -sha256
    Hash algorithm, in this case SHA-2 (SHA-256).
  • -newkey rsa:3072
    Length and type of the keys to be generated, in this case RSA with 3072 bits. Alternatively, a longer key of 4096 bits can be used. Shorter keys are no longer considered sufficiently secure.
  • -keyout pkey.pem
    Private key, usually protected by a passphrase (password). During key generation, you will be prompted to set a passphrase. Afterwards, ensure that only you or the root user can read the private key and that the key never leaves your computer or the target server!
  • -out csr.pem
    Certificate Signing Request (CSR), the certificate request file that will be uploaded further in the process.

Check CSR file

 

If you would like to review the certificate request again, you can view it in plain text. The command for this is:

openssl req -in csr.pem -text -noout

Upload CSR file

 

Depending on the use case, the resulting CSR file must be uploaded either to HARICA or to the internal certification authority TUHH-DFN-PKI in the application form.