-
服务端
-
创建自签名证书
生成私钥openssl genrsa -out jianfaprivate.key 2048证书请求
openssl req -key jianfaprivate.key -new -out jianfacertificate.csr证书签名
openssl x509 -req -in jianfacertificate.csr -signkey jianfaprivate.key -out jianfacertificate.pem查看证书
openssl x509 -in jianfacertificate.pem -text -noout转换证书格式
openssl pkcs12 -export -out jianfacertificate.pkcs12 -inkey jianfaprivate.key -in jianfacertificate.pem -
把证书导入keystore
keytool -importkeystore -srckeystore jianfacertificate.pkcs12 -destkeystore jianfa.keystore -deststoretype pkcs12keytool -list -keystore jianfa.keystore -v -
启动springboot
application.yml配置
server: ssl: key-store: classpath:jianfa.keystore key-store-type: PKCS12 key-password: 123456 key-store-password: 123456 key-alias: 1
-
-
客户端(浏览器)
-
chrome://settings/
隐私设置和安全性
管理证书
导入jianfacertificate.pem

-
打开浏览器访问
https://localhost:8080/hello。
-
springboot使用https
最新推荐文章于 2025-03-17 07:30:00 发布
本文详细介绍如何使用openssl创建自签名SSL证书,并将其部署到Spring Boot应用中,同时指导如何在浏览器中导入证书以实现HTTPS访问。
20万+

被折叠的 条评论
为什么被折叠?



