INT-2868 Fix SSL Key Store Resource Handling #697

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@garyrussell
Member

Documentation indicates that the keystore and truststore
arguments can be resource patterns (file:..., classpath:..., etc)
but the code always used a ClasspathResource.

Use a PathMatchingResourcePatternResolver to interpret the
pattern correctly.

Add tests.

@artembilan artembilan commented on an outdated diff Jan 10, 2013
...p/connection/support/DefaultTcpSSLContextSupport.java
@@ -68,8 +73,8 @@ public SSLContext getSSLContext() throws GeneralSecurityException, IOException
KeyStore ks = KeyStore.getInstance("JKS");
KeyStore ts = KeyStore.getInstance("JKS");
- ks.load(new FileInputStream(new ClassPathResource(keyStore).getFile()), keyStorePassword);
- ts.load(new FileInputStream(new ClassPathResource(trustStore).getFile()), trustStorePassword);
+ ks.load(new FileInputStream(keyStore.getFile()), keyStorePassword);
+ ts.load(new FileInputStream(trustStore.getFile()), trustStorePassword);
artembilan
artembilan Jan 10, 2013 Member

Hi, Gary!
How are you?
There is no reason to wrap Resource to FileInputStream:
ks.load(keyStore.getInputStream(), keyStorePassword);

@garyrussell garyrussell INT-2868 Fix SSL Key Store Resource Handling
Documentation indicates that the keystore and truststore
arguments can be resource patterns (file:..., classpath:..., etc)
but the code always used a ClasspathResource.

Use a PathMatchingResourcePatternResolver to interpret the
pattern correctly.

Add tests.
d9a6df9
Member

Thanks; pushed change in an amended commit

Member

LGTM - merging

@ghillert ghillert closed this Jan 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment