
【HTTPS】通过OpenSSL在Windows上生成Https证书

下载和安装OpenSSL
可以去百度下载OpenSSL Win64,也可以从下面的地址下载
生成证书
切换到openssl/bin目录,执行以下指令生成证书
创建自签名根证书
openssl req -new -x509 -days 365 -extensions v3_ca -keyout crt/ca.key -out crt/ca.crt
创建服务端证书
openssl genrsa -out crt/server.key 2048
openssl req -out crt/server.csr -key crt/server.key -new
openssl x509 -req -in crt/server.csr -CA crt/ca.crt -CAkey crt/ca.key -CAcreateserial -out crt/server.crt -days 365
创建客户端证书
openssl genrsa -out crt/client.key 2048
openssl req -out crt/client.csr -key crt/client.key -new
openssl x509 -req -in crt/client.csr -CA crt/ca.crt -CAkey crt/ca.key -CAcreateserial -out crt/client.crt -days 365
所有证书和中间文件,会保存到crt目录当中
中间会要求输入许多的信息,都可以跳过
只有操作密码和主机名,是必须输入的
Pass Phrase:操作密码,可以用123456
Common Name:主机名,可以用域名或IP
证书生成完毕后,记得双击crt证书文件,将其安装到【受信任的根证书颁发机构】




更多推荐
所有评论(0)