繁体   English   中英

QuickFIX / J CA证书验证

[英]QuickFIX/J CA Certificate Validation

我有一个使用QuickFIX / J编写的与彭博服务器连接的应用程序。 最近,彭博社向其服务器添加了CA证书验证,并且它们还提供了用于握手的其他CA证书文件。

我的应用程序使用SSL连接,并且在从Bloomberg端禁用CA证书验证时,应用程序成功连接到服务器并获取消息。 启用CA验证时,握手失败。

以下是我尝试的步骤。

  1. 以前,我使用ImportKey Java类添加证书和密钥。 我将其更改为添加多个证书。 如果需要,我可以发布Java类。
  2. 当我使用openssl s_client连接到服务器时,它成功连接到服务器。

在应用程序级别需要更改什么吗? 组态? 还是在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证书验证时出现错误。

是的,如果该应用程序以前使用过ssl。 您不需要在应用程序端进行任何更改。 通常,Quickfix / j像Java一样处理ssl验证。 这意味着openssl和Java keytool将为您解决问题。 因此,步骤在下面列出。

  1. 使用信任证书,私钥和ca证书创建pkcs12密钥库。
 $ openssl pkcs12 -export -chain -in certificate.pem -inkey encodedKey.pem -out keystore.p12 -name importkey -CAfile CAcertificate.pem 

输入导出密码:importkey验证-输入导出密码:importkey

  1. 使用keytool,通过名为/root/.keystore的quickfix / j将PKCS12密钥库导入到生成的密钥库中。 同样,您可以选择其他密码。
 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 
  1. 更改配置文件,然后将密钥库复制到类路径。
 SocketKeyStore=keystore.ImportKey cp /root/.keystore keystore.ImportKey /your/classpath 

而已。 请注意,由于quickfix / j会维护自己的密钥库,因此无法向quickfix / j添加ssl密钥和证书到Java密钥库。 因此,请确保在密钥添加过程之后将密钥库添加到类路径。

参考-https: //blogs.oracle.com/jtc/entry/installing_trusted_certificates_into_a

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM