配置IBM Websphere Mq服务器和Java客户端以创建SSL连接

时间:2017-03-18 10:56:08

标签: java ssl ibm-mq

我需要在IBM MQ Qmanager和Java Client之间创建SSL连接。为了使用IBM Key Management GUI执行此操作,

  1. 为QManager创建了key.dkb并为其添加了自签名证书。
  2. 然后我提取了该证书。(cert.arm)
  3. 创建了trustStore.jks文件,并且在签名者身份证明下我添加了先前提取的cert.arm。
  4. 将key.dkb的路径放到Qmanager-> SSL并选择合适的密码。
  5. 在Java Client中将System.property添加到trustStore.jks。
  6. 当我运行该程序时,我得到一个例外,如下所示。

    Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2397' ('MQRC_JSSE_ERROR').
            at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
            ... 10 more
    Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9204: Connection to host '127.0.0.1(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5=default]],3=127.0.0.1(1414),5=RemoteTCPConnection.protocolConnect]
            at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2282)
            at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1294)
            at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
            at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:560)
            at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:345)
            ... 9 more
    Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[Remote host closed connection during handshake],3=localhost/127.0.0.1:1414 (localhost),4=SSLSocket.startHandshake,5=default]
            at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1329)
            at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:863)
            at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)
            at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)
            at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)
            at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1730)
            ... 13 more
    Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
            at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
            at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
            at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1298)
            at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1290)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1290)
            ... 18 more
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
            at sun.security.ssl.InputRecord.read(InputRecord.java:505)
            at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
            ... 25 more
    

    基本上这意味着Qmanager没有由trustStore签名的证书。 所以我想我在制作自签名证书和信任库时遗漏了一些东西。

    有人可以帮助我创建自签名证书,以使用IBM Key Management GUI工具与Java客户端建立SSL连接吗?

1 个答案:

答案 0 :(得分:1)

我可以通过ibm mq troubleshooting guide

解决问题

我刚刚在Qmanager密钥库存储库中运行了mqcertck命令,发现它没有读取key.kdb的访问权限。在使用chmod问题解决后给予读访问权限。