Search code examples
openssl

is it possible making openssl skipping the country/common name prompts?


Is there a way to make openssl skiping the prompts such as

Country Name (2 letter code) [US]:
Organization Name (eg, company) [My Company Name LTD.]:
Common Name (eg, YOUR name) [something]:

While creating certificates with

openssl req -config openssl.cnf -new -x509 ...

given the fact those parameters are provided in the openssl.cnf file

e.g.

countryName         = Country Name (2 letter code)
countryName_default     = US
countryName_min     = 2
countryName_max     = 2
0.organizationName      = Organization Name (eg, company)
0.organizationName_default  = My Company Name LTD.
commonName          = Common Name (eg, YOUR name)
commonName_max      = 64
commonName_default      = ${ENV::CN}

Solution

  • thanks to @indiv

    according to this guide -subj is the way to go, e.g.

    -subj '/CN=www.mydom.com/O=My Company Name LTD./C=US'