用openssl 创建自签名证书用于内网HTTPS

主要命令

openssl req -x509 -newkey rsa:2048 -out CA.cer -outform PEM -keyout CA.pvk -days 10000 -verbose -nodes -sha256 -subj "/CN=ynbit CA"

openssl req -newkey rsa:2048 -keyout ServerCA.pvk -out ServerCA.req -subj /CN=10.20.0.17-sha256 -nodes

openssl x509 -req -CA CA.cer -CAkey CA.pvk -in ServerCA.req -out ServerCA.cer -days 10000 -extfile Server.ini -sha256 -set_serial 0x1111

Server.ini内容如下:

#开始

subjectAltName = @ynbtn

extendedKeyUsage = serverAuth

ynbtn

域名,如有多个用DNS.2,DNS.3...来增加

DNS.1 =

IP地址

IP.1 = 10.20.0.17

#结束

在iis 上使用时必须转换为pfx.

openssl pkcs12 -export -out server.pfx -inkey server.key -in server.cer

上法生成的pfx在windows server 2016 上无法使用,导入时始终提示密码不正常,据说在2019上可以使用。

增加参数如下后可以正常使用。

openssl pkcs12 -macalg SHA1 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -out serv.pfx -inkey serverca.pvk -in serverca.cer

在windows客户端导入ca.cer,将正常使用。

参考文献

内网使用openssl自签名证书开启https连接,同时解决chrome浏览器中的不安全访问

https://blog.csdn.net/weixin_44021888/article/details/140175819

导入pfx到IIS Windows Server 2016 -指定的网络密码不正确

https://www.saoniuhuo.com/question/detail-2195591.html

相关推荐
ftpeak3 天前
从零开始使用 axum-server 构建 HTTP/HTTPS 服务
网络·http·https·rust·web·web app
00后程序员张3 天前
详细解析苹果iOS应用上架到App Store的完整步骤与指南
android·ios·小程序·https·uni-app·iphone·webview
weixin_456904273 天前
使用HTTPS 服务在浏览器端使用摄像头的方式解析
网络协议·http·https
不会叫的狼3 天前
HTTPS + 域名 + 双向证书认证(下)
https
DoWhatUWant4 天前
域格YM310 X09移芯CAT1模组HTTPS连接服务器
服务器·网络协议·https
Whisper_Yu4 天前
计算机网络(一)基础概念
计算机网络·http·https·信息与通信
m0_749299954 天前
HTTP与HTTPS
网络协议·http·https
2501_916007475 天前
Transporter App 使用全流程详解:iOS 应用 ipa 上传工具、 uni-app 应用发布指南
android·ios·小程序·https·uni-app·iphone·webview
2501_915909066 天前
HTTPS 错误解析,常见 HTTPS 抓包失败、443 端口错误与 iOS 抓包调试全攻略
android·网络协议·ios·小程序·https·uni-app·iphone
乖女子@@@6 天前
协议_https协议
http·https·iphone