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

Java 如何添加新的SSL连接Spring Boot jks cacerts,java,spring,spring-boot,ssl,jks,Java,Spring,Spring Boot,Ssl,Jks,我有一个Spring启动应用程序。我有一个用于SSL连接的truststore cacerts文件。我使用以下命令将其加载到应用程序中: -Djavax.net.ssl.trustStore="$basedir/cacerts" 现在我需要添加一个新的ssl连接,我有一个key.jks文件。如何将其添加到我的应用程序中 我想我需要将key.jks添加到cacerts文件中,但当使用keytool添加它时,我得到了一个异常 Input non a x.509 certific

我有一个Spring启动应用程序。我有一个用于SSL连接的truststore 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=

您必须使用如下应用程序属性配置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=