OpenSSL "req new -batch" - Using DN Default Values Only


How to run OpenSSL "req -new" command in batch mode? I don't OpenSSL to use DN default values only and do not prompt me.



If you have DN (Distinguished Name) default values provided in the configuration file, you can run OpenSSl "req -new -batch" command to take default values only without prompt as shown below:

C:\Users\fyicenter>type test.cnf
# unnamed section of generic options
default_md = md5

# default section for "req" command options
input_password     = fyicenter
prompt             = yes
distinguished_name = my_req_dn_prompt


# Minimum of 4 bytes are needed for common name
commonName         = Common Name
commonName_default = CA

# ISO2 country code only
countryName         = Country Name
countryName_default = US

# State is optional, no minimum limit
stateOrProvinceName         = State
stateOrProvinceName_default = NY

# City is required
localityName         = City
localityName_default = New York

# Organization is optional
organizationName         = Organization
organizationName_default =

# Organization Unit is optional
organizationalUnitName         = Department
organizationalUnitName_default = IT

# Email is optional
emailAddress         = Email
emailAddress_default =


OpenSSL> req -new -key rsa_test.key -out test.csr -config test.cnf -batch

OpenSSL> req -in test.csr -text -noout
Certificate Request:
        Version: 0 (0x0)
        Subject: CA, C=US, ST=NY, L=New York,, 

The output confirms that "req -new -batch" uses DN default values without prompting the user.


OpenSSL "req -new" - "no objects specified in config file" Error

OpenSSL "req" - "prompt=yes" Mode with DN Defaults

OpenSSL "req" Command

⇑⇑ OpenSSL Tutorials

2016-10-29, 4506🔥, 0💬