Generating an RFC 2818 compliant certificate request for SSL certificates

With the Chromium project and products based on it such as Google Chrome and Microsoft Edge, Google has moved to enforcing RFC 2818 , which was adopted in 2000, and to no longer trusting certificates that no longer fulfill the RFC.

For us, the following sentence is highly significant:

If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead

— https://tools.ietf.org/html/rfc2818

Please note that the statements regarding the mapping of identity within a certificate in this article are aimed exclusively at the HTTP over SSL (HTTPS) use case.

The RFC thus requires that the identity of a web page should no longer be formed from the Common Name field within the Subject, but from one or more dNSName entries within the Subject Alternative Name (SAN) extension within the certificate. Thus, a certificate without a SAN extension is not RFC compliant and will no longer be accepted by these browsers.

Browser error "Your connection isn't private" with NET::ERR_CERT_COMMON_NAME_INVALID for pki.fabrikam.com, next to a certificate with the subject CN = pki.fabrikam.com

Certificate dialog, "Details" tab: subject CN = ndes01.intra.adcslabor.de

Identity via Common Name (CN) within the subject, should no longer be done.

Certificate dialog, "Details" tab: Subject Alternative Name DNS Name=ndes01.intra.adcslabor.de

Identity via dNSName entry within the Subject Alternative Name extension, the variant required by RFC 2818.

Create a certificate request

Do you know TameMyCerts? TameMyCerts is an add-on for the Microsoft certification authority (Active Directory Certificate Services). It extends the function of the certification authority and enables the application of rule sets to realize the secure automation of certificate issuance. TameMyCerts is unique in the Microsoft ecosystem, has already proven itself in countless companies around the world and is available under a free license. It can be downloaded via GitHub and used free of charge. Professional maintenance is also offered.

The process for requesting an RFC 2818-compliant certificate from the Microsoft certification authority is described below. A method has been deliberately chosen here which is divided into the individual process steps and can therefore also be adapted for other systems (for example Linux).

Manual creation of the certificate request

This method is useful for systems that are not members of the same Active Directory forest as the certification authority. See article "Manually requesting a web server certificate ".

Creating the certificate request via the Microsoft Management Console (MMC)

This method is useful if the web server and the certification authority are members of the same Active Directory forest and can therefore use the certificate templates stored in Active Directory.

The first step is to generate a key pair and a certificate request (CSR) on the target system. This step depends on the target operating system (Windows, Linux, etc.) and must be performed by the respective IT service owner (the enrollee).

For Windows, the certificate management console for the computer account (certlm.msc) is started and Certificates is right-clicked under Personal. In the context menu, select All Tasks - Advanced Operations - Create Custom Request.

certlm: context menu "All Tasks", "Advanced Operations", "Create Custom Request..." in the "Personal", "Certificates" folder

Now select the certificate template and click Next.

Wizard "Custom request": template "ADCS Labor Web Server", request format PKCS #10

Before the certificate request is generated, Properties is clicked in the subsequent dialog under Details. In the case of a web server certificate, the enrollee usually specifies the identity, which still has to be configured.

Wizard "Certificate Information": template "ADCS Labor Web Server" with STATUS: Available, "Details" and "Properties" buttons highlighted in yellow

According to RFC 2818, the subject of the certificate may be empty if a Subject Alternative Name exists. The Subject Alternative Name extension behaves as follows for the Microsoft certification authority in compliance with RFC 2818:

  • If the subject is empty, the Subject Alternative Name extension is marked as critical, since it contains the only way to determine the identity.
  • If a Common Name exists within the Subject, the Subject Alternative Name extension is marked as not critical to allow applications to fallback should they not understand the SAN extension.

Experience shows that it is quite possible that a certificate can be used by an application that has not been programmed to conform to RFC 2818. This would possibly not know the Subject Alternative Name extension and then ignore it. If the SAN extension is marked as critical, the processing of the certificate would have to be aborted in this case.

For this reason, it is quite advisable to continue to populate the Common Name. This does not violate RFC 2818, since a SAN extension is available for all compliant applications.

"Certificate Properties", "Subject" tab: common name CN=ndes01.intra.adcslabor.de and alternative name type DNS highlighted in yellow

The certificate request can now be saved to a file. Which encoding is selected here is of secondary importance.

Wizard "Where do you want to save the offline request?": file ndes01.req in "Base 64" format

A key pair and a certificate request are now generated. This must be sent to the certification authority in the next step.

Sending the certificate request to the certification authority

Regardless of how the certificate request was generated (Windows, Linux, etc.), the CSR file can now be sent to the appropriate certification authority.

This can be done from any Windows computer in the Active Directory forest, but the executing user must have the Enroll permission on the target certificate template.

certreq -submit {Zertifikatanforderung}.req

For certificate requests that were not created with the Microsoft MMC, no information about the certificate template is available. This information must be provided manually during the request:

certreq -attrib "CertificateTemplate:{Name-der-Zertifikatvorlage}" -submit {Zertifikatanforderung}.req

One is now prompted to select a target certification authority.

Command prompt: certreq -submit ndes01.req opens the "Certification Authority List" with ADCS Labor Issuing CA 1 and CA 2

The certificate request is then sent to the certification authority. If the certificate template is configured in such a way that the request must first be checked by a certificate manager, you will be notified of this fact and will not receive a certificate back for the time being. It is important to note down the RequestId that is displayed, as this is required to retrieve the certificate.

certreq -submit: "Certificate request is pending: Taken Under Submission (0)" with RequestId 165466

Collecting the issued certificate from the certification authority

After the certificate has been issued by a certificate manager, it can be retrieved from the certification authority with the following command.

certreq -reqtrieve {Request-ID}

Again, you have to select the target certification authority.

Command prompt: certreq -retrieve 165466 opens the "Certification Authority List" with ADCS Labor Issuing CA 2 selected

Afterwards, the certificate can be saved as a file.

Dialog "Save Certificate": file name ndes01.cer, type X.509 Certificate (*.cer; *.crt; *.der)

certreq -retrieve 165466: "Certificate retrieved(Issued) Issued  Resubmitted by INTRA\Administrator"

Connecting the issued certificate with the private key

This step again depends on the target system (Windows, Linux). The issued certificate must now be associated with the previously created private key before it can be used. Administrator rights are required for this if the certificate request was created in the machine context.

certreq -accept {Zertifikat}.cer

Command prompt: certreq -accept ndes01.cer installs the certificate with subject CN=ndes01.intra.adcslabor.de

Binding the certificate to the application

The issued and installed certificate must now be bound to the target application. This step depends on the target application (for example, IIS, Apache, NGINX). For the Network Device Enrollment Service (NDES) here is an example .