使用pem和key文件给springboot开启https服务

操作步骤

1. 将两个文件整合为springboot支持的p12文件

复制代码
openssl pkcs12 -export -out G:\\rrr\\server.p12 -in G:\\rrr\\aaa.com.pem -inkey G:\\jftest\\aaa.com.key  -name aaa

回车后输入密码:123456

2. 设置springboot:

复制代码
server:
  port: 8088
  ssl:
    key-store: classpath:server.p12  # .p12 文件在 resources 目录下的路径
    key-store-type: PKCS12  # 密钥库类型(固定为 PKCS12)
    key-store-password: 123456  # 步骤 2 中设置的密钥库密码
    key-alias: aaa  # 步骤 2 中设置的别名
    key-password: 123456  # 私钥密码(若与密钥库密码相同,可省略)

3. 测试:

https://localhost:8088/test/hello

tips

查看域名:

复制代码
openssl x509 -in G:\\rrr\\aaa.com.pem -noout -text
相关推荐
发光小北6 小时前
四路can转WIFI在现场应用中有什么问题?
网络协议
zxanz110 小时前
网站为什么需要 SSL 证书来实现 https?
https
长按助力退休12 小时前
HTTP缓存从强缓存到协商缓存,前端性能优化第一步
http
Lsetea15 小时前
curl报58 unable to set private key file:客户端证书与私钥加载排查
运维·https·ssl证书·openssl·curl
Lsetea16 小时前
OpenSSL报certificate is not yet valid:error 9与notBefore时间排查
linux·运维·https·ssl证书·openssl
2501_9159090616 小时前
iOS应用从开发到上架App Store的完整发布流程与步骤指南
android·ios·小程序·https·uni-app·webview
刘马想放假17 小时前
网络链路备份与高可用技术详解:从 Dual-WAN、LACP 到 SD-WAN 与 MPTCP
网络协议
Zelman17 小时前
第07章-数据中心网络
后端·网络协议
Smoothcloud润云18 小时前
GPU服务器租用实例DNS与HTTPS下载排障实战
大数据·运维·服务器·人工智能·https·gpu算力
网络小江20 小时前
上网第四十八课:抓包实战入门——Wireshark 读懂第一个包
网络协议