javaspringspring-bootsslssl-bundle

Spring Boot's application.proprerties: Can I use server.ssl.key-store and SSLBundle spring.ssl.bundle.jks.mybundle.keystore.location at the same time?


I am using Spring Boot 3.4.1 , Java / JDK 23, Windows 10 pro x64. Spring Boot's application.proprerties: Can I use server.ssl.key-store

server.ssl.key-store-type=PKCS12
server.ssl.key-store=C:\\Users\\JAMES\\fuu\\bar\\foo.p12
server.ssl.key-store-password=123xxx3
server.ssl.key-alias=foo
server.ssl.client-auth=want

and SSLBundle spring.ssl.bundle.jks.foobundle.keystore.location

spring.ssl.bundle.jks.foobundle.key.alias=foo
spring.ssl.bundle.jks.foobundle.truststore.location=C:\\Users\\JAMES\\fuu\\bar\\foo.p12
spring.ssl.bundle.jks.foobundle.truststore.password=123xxx3
spring.ssl.bundle.jks.foobundle.truststore.type=PKCS12

at the same time?

If there are used in same time is valid, what is the order / what will be in effect?

Related https://docs.spring.io/spring-boot/reference/features/ssl.html#features.ssl.jks


Solution

  • In your example, the SSL bundle foobundle would not be used for the web server because you have not set server.ssl.bundle=foobundle. The SSL bundle could be used for other types of connections.

    If you set server.ssl.bundle=foobundle, then all other server.ssl properties that specify key material will be ignored. server.ssl.client-auth=want will still be used because it is specific to the web server and cannot be configured using an SSL bundle.