On my pc with Windows 10 installed, I have to use OpenSSL. I have downloaded the version 1.0.2n and following this guide: Creating an SSL Certificate with Multiple Hostnames I modified the openssl.cfg configuration file (located in C:\OpenSSL-Win64\bin).
After some testing, I can generate with no problem both keys and certificates.
My problem is the following: my indications for the certificates generation are such that the Subject Alternative Name must have only 1 value and must match with the Common Name field. So, if (filling out certificate) I fill the commonName field with example.com, also the Subject Alternative Name must be example.com. I know that I can change every time the cfg file and set manually the value for the SAN in the v3-req section, but I want avoid this; I'm searching for a way to copy the value I prompt for the common name in the SAN field.
So, I tried this: in the openss.cfg file I went to v3 req section and I changed it in this way:
[ v3_req ] # Extensions to add to a certificate request basicConstraints = CA:FALSE keyUsage = nonRepudiation, digitalSignature, keyEncipherment subjectAltName = @alt_names [alt_names] DNS.1 = commonName:copy
that is, I tried to exploit the :copy function but, unfortunately, this action does not work. If, after certificate generation, I launch the command
req -text -noout -in <filename.csr>
to verify my certificate, in the specific section I get this:
X509v3 Subject Alternative Name: DNS:commonName.copy
As you can see, the output is the right side of my declaration under the
So, the questions are: Is there a method to to inherit the commonName to the subject alternative name? And if yes, how?