Does OpenSSL really need a path to openssl.conf?

后端 未结 3 2065
一整个雨季
一整个雨季 2021-02-07 10:47

I want to create a self-signed-certificate in PHP 5.x. with my own (alternative) openssl configuration which should be defined by my PHP code. The PHP script will run on differe

3条回答
  •  爱一瞬间的悲伤
    2021-02-07 11:35

    There are many configuration settings in OpenSSL that can't be defined in PHP by $configargs (the PHP parameters you pass to the OpenSSL functions).

    If you don't specify an alternative openssl configuration file, it will automatically take the default openssl.cnf.

    Recommendation: Since your script will run on different servers, you should always use your own openssl.cnf.

    Just create a simple text file and put the following 4 lines in it. Then pass the path to it to the OpenSSL function you are using (look at your second example above).

    distinguished_name  = req_distinguished_name
    [req_distinguished_name]
    [v3_req]
    [v3_ca]
    

    It seems that these 4 lines are the minimum openssl.cnf must contain.

提交回复
热议问题