java - 如何添加新的 SSL 连接 Spring Boot jks cacerts

标签 java spring spring-boot ssl jks

我有一个 Spring Boot 应用程序。我有一个用于 SSL 连接的信任库 cacerts 文件。我使用以下命令将其加载到应用程序中:

-Djavax.net.ssl.trustStore="$basedir/cacerts"
现在我需要添加一个新的 ssl 连接,我有一个 key.jks 文件。如何将其添加到我的应用程序中?
我以为我需要将 key.jks 添加到 cacerts 文件中,但是使用 keytool 添加它时出现异常
Input non a x.509 certificate

最佳答案

您必须使用以下应用程序属性配置您的 Spring Boot 项目:

# The format used for the keystore. It could be set to JKS in case it is a JKS file
server.ssl.key-store-type=
# The path to the keystore containing the certificate
server.ssl.key-store=classpath:cacerts
# The password used to generate the certificate
server.ssl.key-store-password=
# The alias mapped to the certificate
server.ssl.key-alias=

关于java - 如何添加新的 SSL 连接 Spring Boot jks cacerts,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64721380/

相关文章:

java - Spring Jackson 通过 Id 引用现有对象反序列化对象

java - 如何将值或参数从jsp传递到Spring Controller ?

java - 如何使用 apache poi 3.5 和 java 以编程方式读取和更新动态 Excel 文件?

java - 这段代码是如何工作的以及输出是什么..这看起来很简单

java - Android:将选择的不同布局动态加载到另一个布局中

java - Jackson StdDeserializer 的自定义实例中 Autowiring Bean

gradle - Spring Boot 和 Gradle(maven parent poms)

java - 安装 Spring Boot 应用程序

java - Spring Integration JDBC 入站轮询器基于 Java 的配置

java - 如何在执行操作之前设置计时器?