2013-01-14 71 views
1

更新Spring Integration 2.2.1Spring集成TCP連接工廠SSL - 使用Java密鑰

修正我有一個tcp-connection-factory

<int-ip:tcp-connection-factory id="tranServer" type="client" host="127.0.0.1" port="1234" 
    single-use="true" ssl-context-support="sslContext" /> 

<bean id="sslContext" class="org.springframework.integration.ip.tcp.connection.support.DefaultTcpSSLContextSupport"> 
    <constructor-arg value="client.ks" /> 
    <constructor-arg value="client.truststore.ks" /> 
    <constructor-arg value="secret" /> 
    <constructor-arg value="secret" /> 
</bean> 

而且我想使用默認的Java密鑰庫的SSL上下文的一部分安裝過程是將SSL證書加載到其中。如何指定默認密鑰庫和信任庫密碼。

回答

2

更新Spring Integration 2.2.1

固定的本質問題是DefaultTcpSSLContextSupport負載從一個ClassPathResource密鑰庫和信任的方法getSSLContext()

ks.load(new FileInputStream(new ClassPathResource(keyStore).getFile()), keyStorePassword); 
ts.load(new FileInputStream(new ClassPathResource(trustStore).getFile()), trustStorePassword); 

我創建了自己FileTcpSSLContextSupport類刪除ClassPathResource

ks.load(new FileInputStream(keyStore), keyStorePassword); 
ts.load(new FileInputStream(trustStore), trustStorePassword); 

然後我創建bean與

<bean id="sslContext" class="com.liquidtelecoms.tillintegration.FileTcpSSLContextSupport"> 
    <constructor-arg value="${java.home}/lib/security/cacerts" /> 
    <constructor-arg value="${java.home}/lib/security/cacerts" /> 
    <constructor-arg value="changeit" /> 
    <constructor-arg value="changeit" /> 
</bean> 
+1

是的,我最近注意到這個問題;我有一個開放的Pull Request,很快就會合並:https://github.com/SpringSource/spring-integration/pull/697 –