Spring Boot-启用和配置SSL证书 [英] Spring Boot - enable and configure SSL certificate

查看:638
本文介绍了Spring Boot-启用和配置SSL证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有此证书/文件,以便为我的应用程序启用SSL:

I have this certificates / files in order to enable SSL for my application:

我发现Spring Boot启用HTTPS需要这些属性:

I found out that this properties are needed for Spring Boot to enable HTTPS:

server.port=8089
server.ssl.enabled=true
server.ssl.key-store=src/main/resources/keystore.p12
server.ssl.key-store-password=****
server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias=tomcat

但是这不起作用.现在我的问题是,要使其正常工作,我必须做什么? https://abc.lehr.co.at 应该是URL.

but this does not work. My question now would be what do I have to do in order to get it work? https://abc.lehr.co.at should be the URL.

我创建了自己的密钥库-出现以下异常:

I have created my own keystore - with this I get the following exception:

java.io.IOException: Alias name tomcat does not identify a key entry
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:596)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:534)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:363)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:739)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:472)
at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:81)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)

我的密钥库如下:

实际上,我不知道要为嵌入式tomcat(Spring Boot)导入到密钥库中的内容.

Actually I don't know what to import into keystore for embedded tomcat (Spring Boot).

推荐答案

要启用SSL,您必须提供一个私钥,而不是受信任的证书.

To enable SSL, you must provide a private key, and not a trusted certificate.

在密钥库中,应将"tomcat"列为 privatekeyentry 的别名,而不是 trustedcertentry .

In your keystore, 'tomcat' should be listed as an alias for a privatekeyentry and not a trustedcertentry.

这篇关于Spring Boot-启用和配置SSL证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆