用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

相关推荐
游戏开发爱好者87 小时前
BShare HTTPS 集成与排查实战,从 SDK 接入到 iOS 真机调试(bshare https、签名、回调、抓包)
android·ios·小程序·https·uni-app·iphone·webview
2501_9151063210 小时前
苹果软件加固与 iOS App 混淆完整指南,IPA 文件加密、无源码混淆与代码保护实战
android·ios·小程序·https·uni-app·iphone·webview
2501_9160137413 小时前
iOS 推送开发完整指南,APNs 配置、证书申请、远程推送实现与上架调试经验分享
android·ios·小程序·https·uni-app·iphone·webview
2501_9159090617 小时前
HTML5 与 HTTPS,页面能力、必要性、常见问题与实战排查
前端·ios·小程序·https·uni-app·iphone·html5
2501_916013741 天前
iOS 上架 App 全流程实战,应用打包、ipa 上传、App Store 审核与工具组合最佳实践
android·ios·小程序·https·uni-app·iphone·webview
小杨的全栈之路1 天前
生产级实践:在 Docker 中安全导入自签名证书,保障 Spring Boot 应用通信安全
docker·https
00后程序员张1 天前
苹果软件混淆的工程逻辑,从符号空间到资源扰动的体系化实现
android·ios·小程序·https·uni-app·iphone·webview
coder4_2 天前
OpenSSL 加密算法与证书管理全解析:从基础到私有 CA 实战
https·openssl·ssl/tls·加密算法·ca证书
IT_Octopus2 天前
https私人证书 PKIX path building failed 报错解决
java·spring boot·网络协议·https
艾菜籽2 天前
网络原理-HTTPS
网络·网络协议·https