现在的位置: 首页 > 综合 > 正文

在Windows下用OpenSSL生成证书步骤

2017年08月08日 ⁄ 综合 ⁄ 共 1118字 ⁄ 字号 评论关闭

1.签根证书:
openssl genrsa -des3 -out rootca.key 1024
openssl req -new -key rootca.key -out rootca.csr -config F:\xampp\apache\bin\openssl.cnf
openssl req -x509 -days 365 -key rootca.key -in rootca.csr -out rootca.crt -config F:\xampp\apache\bin\openssl.cnf

2.签服务端证书 :
openssl genrsa -des3 -out server.key 1024
openssl rsa -in server.key -out server.key.unsecure
openssl req -new -key server.key -out server.csr -config F:\xampp\apache\bin\openssl.cnf
openssl ca -in server.csr -out server.crt -cert rootca.crt -keyfile rootca.key -config F:\xampp\apache\bin\openssl.cnf

3.签客户端证书:
openssl genrsa -des3 -out client.key 1024
openssl req -new -key client.key -out client.csr -config F:\xampp\apache\bin\openssl.cnf
openssl ca -in client.csr -out client.crt -cert rootca.crt -keyfile rootca.key -config F:\xampp\apache\bin\openssl.cnf
openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.pfx

如果在签发证书时候提示demoCA找不到,则需要修改如下配置

修改:openssl.cnf 的 dir
mkdir demoCA
mkdir demoCA/newcerts
mkdir demoCA/private
touch demoCA/index.txt
echo “01″ >> demoCA/serial

以上证书都能正常生成,但是部署到apache时候,请求客户端证书总是失败。
SSLVerifyClient require
SSLVerifyDepth 1
SSLCACertificateFile /etc/apache2/conf/ssl/my-ca.crt
查看了错误日志,问题出现在SSLCACertificateFile。
具体还不知道什么原因。

抱歉!评论已关闭.