简体   繁体   中英

SSL not working with IBM MQ 8 client jars

SSL works with IBM MQ 6 client jars but the same code doesn't work with IBM 8 jars.Did anyone faced issue with IBM 8 client jars.

Code:

            com.ibm.mq.MQQueueManager qmRequest = null;
            com.ibm.mq.MQQueue qRequest = null;

            com.ibm.mq.MQMessage reqMsg = new com.ibm.mq.MQMessage();
            reqMsg.writeString(new String("first MQ SSL Message test"));
            reqMsg.messageId = "1".getBytes();
            reqMsg.correlationId = "2".getBytes(); 



            System.setProperty("javax.net.ssl.trustStore", "D:/keystore/testKS.jks");
            System.setProperty("javax.net.ssl.trustStorePassword", "12345678");
            System.setProperty("javax.net.ssl.keyStore", "D:/keystore/testKS.jks"); 
            System.setProperty("javax.net.ssl.keyStorePassword", "12345678"); 
            Hashtable<String,Object> propMap = new Hashtable<String,Object>();

            propMap.put(MQConstants.HOST_NAME_PROPERTY, "localhost");
            propMap.put(MQConstants.PORT_PROPERTY,  1415);
            propMap.put(MQConstants.CHANNEL_PROPERTY, "testG");
            propMap.put(MQConstants.SSL_PEER_NAME_PROPERTY, "CN=ibmwebspheremqtestqu");

            String qmNameRequest = "testQu";
            String qNameRequest = "testQQ";
            propMap.put(MQConstants.SSL_CIPHER_SUITE_PROPERTY,  "TLS_RSA_WITH_AES_128_CBC_SHA");
            qmRequest = new com.ibm.mq.MQQueueManager(qmNameRequest,propMap);

            int reqQueueOpt = MQConstants.MQOO_OUTPUT | MQConstants.MQOO_SET_IDENTITY_CONTEXT;
            qRequest = qmRequest.accessQueue(qNameRequest, reqQueueOpt);
            reqMsg.messageType = MQConstants.MQMT_DATAGRAM;
            com.ibm.mq.MQPutMessageOptions reqMsgOpt = new com.ibm.mq.MQPutMessageOptions();
            reqMsgOpt.options = MQConstants.MQPMO_SET_IDENTITY_CONTEXT;

            qRequest.put(reqMsg, reqMsgOpt);
            qRequest.close();
            qmRequest.disconnect();

The above code works with IBM jdks but with oracle jdk it always fails and throws exception related to SSL.

Did you read this: http://www-01.ibm.com/support/docview.wss?uid=swg1IV66840

Did you set the JVM environment variable "-Dcom.ibm.mq.cfg.useIBMCipherMappings=false" as noted in the IBM support doc?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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