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

后端 未结 5 1710
长情又很酷
长情又很酷 2021-01-31 13:05

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 Nam         


        
5条回答
  •  醉梦人生
    2021-01-31 13:39

    Generate a config file and in the [req] section you can put prompt = no.

    For example:

    [req]
    prompt = no
    distinguished_name = req_distinguished_name
    req_extensions = v3_req
    
    [req_distinguished_name]
    C = US
    ST = California
    L = Los Angeles
    O = Our Company Llc
    #OU = Org Unit Name
    CN = Our Company Llc
    #emailAddress = info@example.com
    
    [v3_req]
    basicConstraints = CA:FALSE
    keyUsage = nonRepudiation, digitalSignature, keyEncipherment
    subjectAltName = @alt_names
    
    [alt_names]
    DNS.1 = example.com
    DNS.2 = www.example.com
    

    Then just execute e.g.

    openssl req -new -sha256 -config THATFILE.conf -key example.com.key -out example.com.csr
    

提交回复
热议问题