OpenSSL 命令生成V3的自签证书
1.下载并安装OpenSSL
- Windows版本的OpenSSL下载地址:https://slproweb.com/products/Win32OpenSSL.html
- 下载安装完成后,为了以后方便操作,可以将OpenSSL添加到环境变量中
2.生成证书
-
使用命令生成一个2048位的证书密钥
- openssl genrsa -out test.key 2048
-
生成证书请求文件csr
- openssl req -new -sha256 -key test.key -subj “/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=New Hampshire/1.3.6.1.4.1.311.60.2.1.1=Portsmouth/businessCategory=Private Organization/C=US/ST=New Hampshire/L=Portsmouth/street=Two International Drive/O=GlobalSign Inc./OU=PCompliance/CN=test.globalsign-support.com/serialNumber=578611” -out test.csr
-
生成证书
- openssl x509 -req -days 365 -sha256 -extfile openssl.cfg -extensions v3_req -in test.csr -signkey test.key -out test.crt