我有一个使用QuickFIX / J编写的应用程序与Bloomberg Server连接。最近,Bloomberg将CA证书验证添加到他们的服务器,并且他们提供了额外的CA证书文件以进行握手。
我的应用程序使用SSL连接,当从Bloomberg端禁用CA证书验证时,应用程序成功连接到服务器并获取消息。启用CA验证时握手失败。
以下是我尝试的步骤。
ImportKey
Java类添加证书和密钥。
我更改了它以添加多个证书。如果需要我可以发布
Java类。在应用程序级别是否需要更改任何内容?组态?或者Java密钥库级别有什么事吗?
以下添加连接时出现错误消息:
20160823-06:04:15,FIX.4.4:XXXX-> XXXX,错误> (断开连接:插座 异常(/XXXX.XXXX.XXX.XX:20237): javax.net.ssl.SSLHandshakeException:SSL握手失败。) 已成功注销sessionId:FIX.4.4:XXXX-> XXXX
感谢任何帮助!
配置:
[default]
# Settings which apply to all the Sessions.
ConnectionType=initiator
LogonTimeout=86400
ResetOnLogon=Y
UseDataDictionary=Y
MaxLatency=240
#StartTime=00:00:00
#EndTime=00:00:00
#StartTime=02:30:00
#EndTime=12:30:00
StartTime=02:21:00
EndTime=12:21:00
HeartBtInt=30
ReconnectInterval=5
[session]
# Settings specifically for one session
BeginString=FIX.4.4
SocketConnectHost=xxx.xxx.xxx.xxx
SocketUseSSL=Y
SocketKeyStorePassword=importkey
CheckLatency=N
#SendResetSeqNumFlag=Y
# new setups
FileLogHeartbeats=Y
##----- CAPS Configuration ---------##
FileStorePath=/etc/bloomburg-live/msgs
FileLogPath=/etc/bloomburg-live/logs
DataDictionary=/etc/bloomburg-live/conf/FIX44.xml
SocketKeyStore=/root/.keystore
TargetCompID=BLPSTP
SocketConnectPort=xxxxx
SenderCompID=CAPSTP
# log configuration
FileIncludeMilliseconds=Y
FileIncludeTimeStampForMessages=Y
ScreenLogShowHeartBeats=Y
#Filter heartbeats from output (both incoming and outgoing)
PS - 没有CA证书验证的应用程序工作。启用CA证书验证时出错。
答案 0 :(得分:3)
是的,如果该应用程序以前使用过ssl。您不需要在应用程序端进行任何更改。通常Quickfix / j正在处理ssl验证,就像java一样。这意味着openssl和java keytool将为您提供帮助。所以步骤如下。
$ openssl pkcs12 -export -chain -in certificate.pem -inkey encodedKey.pem -out keystore.p12 -name importkey -CAfile CAcertificate.pem
输入导出密码:importkey 验证 - 输入导出密码:importkey
keytool -importkeystore -destkeystore /root/.keystore -srckeystore keystore.p12 -alias importkey Enter destination keystore password: importkey Re-enter new password: importkey Enter source keystore password: importkey
SocketKeyStore=keystore.ImportKey cp /root/.keystore keystore.ImportKey /your/classpath
多数民众赞成。 请注意,由于quickfix / j正在维护自己的密钥库,因此将ssl密钥和证书添加到java密钥库不适用于quickfix / j。因此,请确保在密钥添加过程之后将密钥库添加到类路径中。
参考 - https://blogs.oracle.com/jtc/entry/installing_trusted_certificates_into_a