Search code examples
c#.netibm-mqxms

Setting up .Net IBM.XMS client with SSL to KDPW


I am trying to connect to the testing environment in KDPW with NEt IBM.XMS

I received a Certificate from KDPW which is store in the Windows certificates store.

I create a KDB file from the received certificate. KDB file is store in the directory C:\directory. The name of the KDB file is nameOfKdbFile.kdb

when I try to connect I received error code:

IBM.XMS.XMSException: 'CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2538. During execution of the specified method an exception was thrown by another component.

Can you help me?

Code:

cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "ipAddress");
cf.SetIntProperty(XMSC.WMQ_PORT, port);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, "channel");
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "queueManager");

cf.SetStringProperty(XMSC.WMQ_SSL_PEER_NAME, "peerName");
cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, "cipherSpec");


cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, @"C:\directory\nameOfKdbFile");
cf.SetStringProperty(XMSC.WMQ_SSL_CLIENT_CERT_LABEL, "ibmwebspheremquserid");

Solution

  • Unmanaged mode is working with settings:

    IConnectionFactory cf = factoryFactory.CreateConnectionFactory();
    
    
    cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "ipAddress");
    cf.SetIntProperty(XMSC.WMQ_PORT, port);
    cf.SetStringProperty(XMSC.WMQ_CHANNEL, "channel");
    cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);
    cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "queueManager");
    
    cf.SetStringProperty(XMSC.WMQ_SSL_PEER_NAME, "peerName");
    cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, "cipherSpec");
    
    cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, @"C:\directory\nameOfKdbFile");
    cf.SetStringProperty(XMSC.WMQ_SSL_CLIENT_CERT_LABEL, "ibmwebspheremquserid");
    

    Kdbfile must has 3 parts: .kdb, .rdb and .sth