How can I add a Subject Alternate Name when signing a certificate request using OpenSSL (in Windows if that matters)?
I've generated a basic certificate signing request (CSR) from the IIS interface. Now, I'd like to add several subject alternate names, sign it with an existing root certificate, and return the certificate to complete the signing request.
Every tutorial I could find involves generating a new private key and a brand new CSR, however I was under the impression that the private key resides on the requesting computer (which I wouldn't necessarily have access to). I just want to sign the request while adding the alternate names. I'm relatively new to OpenSSL and CA topics so this may be a misunderstanding on my part.
Personally I add the alt names at CSR generation, so I know that works (there's a little byplay in default conf files both for generation and signing).
For changing afterwards, as far as I remember the Alt Names are extensions, and it seems you can override or add the extensions you want while doing the signing. I will shamelessly copy:
when you are using the openssl CA (strangely enough: openssl ca) command, you can give it numerous options, including which Subject value to use (the
-subj
argument), and which extensions to use (via the-extfile
and-extensions
arguments).so you can set both which extensions you want and which Subject you want (causing both values in the CSR to be completely ignored) by a command like:
Where:
/etc/myca/openssl-exts.cnf contains: