OpenSSL 生成CA证书及终端用户证书

3、生成ca证书签发请求,得到ca.csr

$ openssl req -new -sha256 -out ca.csr -key ca.key -config ca.conf

配置文件中已经有默认值了,shell交互时一路回车就行。

4、生成ca根证书,得到ca.crt

$ openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca.crt

三、生成服务端证书


1、配置文件

准备配置文件,得到server.conf,内容如下:

[ req ]

default_bits = 2048

distinguished_name = req_distinguished_name

req_extensions = req_ext

[ req_distinguished_name ]

countryName = Country Name (2 letter code)

countryName_default = CN

stateOrProvinceName = State or Province Name (full name)

stateOrProvinceName_default = JiangSu

localityName = Locality Name (eg, city)

localityName_default = NanJing

organizationName = Organization Name (eg, company)

organizationName_default = Sheld

你可能感兴趣的:(程序员,面试,java,后端)