Add Subject Alternative Name (SAN) to a digital certificate
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Subject Alternative Name (SAN) is an extension to X.509 that lets you specify
additional host names (values) to be protected by a single TLS certificate using a
subjectAltName field. It allows more than one host
to use the same copy of a single certificate. At the server-level, you can create
multiple virtual hosts and add these hosts to the subjectAltName field of the certificate. You generate a certificate with
SAN and the clients can connect to the server using subjectAltName. Whenever HTTPS request comes to any of the virtual host,
the server uses the same certificate for TLS handshake.
A Wildcard certificate can protect all first-level sub-domains on a domain,
such as *.example.com but it cannot protect both
www.example.com and www.example.org. Hosting multiple TLS-enabled sites on a single server
typically requires a unique IP address per site, a multi-domain (such as SAN)
certificate with subject alternative names allows you to protect all these sub domains
with a single certificate. However, you can use a Wildcard certificate as part of
SAN.
pkiutil utility, open the pscpki.cnf
file in the %DLC%\keys\policy location and add the subjectAltName values as follows under the x509v3_extensions section:
subjectAltName = @alt_namesAdd the domain names
in the alt_names section as
follows: [alt_names]
DNS.1 = <value>
DNS.2 = <value>www.service1.com and
www.service2.com. So, you have three virtual hosts
www.default.com,
www.service1.com, and www.service2.com and their
loop back address are 127.0.0.1, 127.0.0.2, and 127.0.0.3 respectively. Do the
following:- Open the hosts.txt file from the C:\Windows\System32\drivers\etc location for Windows or the /etc/ location for Linux.
- Add the loop back addresses and the host names. Note: If there is a loop back address that is already assigned to host, use another loop back address, for example, if 127.0.0.1 is already assigned, assign 127.0.0.4 to the www.default.com host.
- Verify if the hosts were added, by pinging each host in the
Command prompt. For example, type
ping www.default.com, if you are able to ping each host successfully, the hosts are added. - Create a copy of the pscpki.cnf file at the %DLC%\keys\policy and name it myssl.cnf.
- Edit the myssl.cnf to add
the following under the
x509v3_extensionssection:subjectAltName = @alt_names [alt_names] DNS.1 = www.service1.com DNS.2 = www.servuce2.com - Generate the public and private key pair using the
pkiutil -keysize 2048 –newreq examplecommand. It creates example.pk1 and example.pk10 files in the %DLC%/keys/requests location.example.pk1serves as your private key andexample.pk10as the public key serves as a Certificate Signing Request (CSR) to a certificate authority (CA). - Verify CSR using the
sslc req -text -in %DLC%\keys\requests\example.pk10 –nooutcommand. - Create a self-signed certificate .cer file and convert to .pem file using pkiutil.
- Open the .pem file and
verify the
subjectAltNamefield by executing the Proenv> sslc x509 -in %DLC%\keys\example.pem -text -noout command. TheX509v3 extensionssection displays thesubjectAltNameas follows:X509v3 extensions: X509v3 Subject Alternative Name: DNS.1 = www.service1.com DNS.2 = www.service2.com