Skip to content

Commit e75d45c

Browse files
icha024mbhave
authored andcommitted
Use empty trust-store password if SSL store provider present
For Tomcat, if an SslStoreProvider is configured, `SslStoreProviderUrlStreamHandlerFactory` stores the trust-store with an empty password. Previously, if a password was supplied using the ssl.trust-store-password property, that would be the password used to load the trust-store and the connector would warn with "Password verification failed" message. Fixes gh-12688
1 parent 7849d73 commit e75d45c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ protected void configureSslStoreProvider(AbstractHttp11JsseProtocol<?> protocol,
118118
SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
119119
}
120120
if (sslStoreProvider.getTrustStore() != null) {
121+
protocol.setTruststorePass("");
121122
protocol.setTruststoreFile(
122123
SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL);
123124
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public void customizeWhenSslStoreProviderPresentShouldIgnorePasswordFromSsl()
170170
Ssl ssl = new Ssl();
171171
ssl.setKeyPassword("password");
172172
ssl.setKeyStorePassword("secret");
173+
ssl.setTrustStorePassword("trustStoreSecret");
173174
SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class);
174175
given(sslStoreProvider.getTrustStore()).willReturn(loadStore());
175176
given(sslStoreProvider.getKeyStore()).willReturn(loadStore());

0 commit comments

Comments
 (0)