.NET客户端通过SSL连接到IBM MQ
我从客户那里获得了密钥文件,在这里我需要使用它们来通过SSL连接到MQ.我们从客户端获得的文件是:
I got key files from our client where I need to use them to connect to MQ over SSL. The files we have got from client are:
xxx.crl
xxx.kdb
xxx.rdb
xxx.sth
xxx.tab
他们说的是客户渠道表.我正在尝试使用以下代码进行连接.他们说我不需要指定将在客户渠道表"中定义的队列管理器.但是,有一件事是他们在使用"user1"创建密钥的同时完成了操作.
They said client channel table in that. I am trying to connect using the below code. And they are saying I don't need to specify the Queue Manager it will be defined in the Client Channel Table. But one thing is they have done while created key with the using "user1".
代码:
Hashtable connectionProperties = new Hashtable();
// Add the connection type
connectionProperties.Add(MQC.TRANSPORT_PROPERTY, connectionType);
MQQueueManager qMgr;
MQEnvironment.SSLCipherSpec = "TRIPLE_DES_SHA_US";
MQEnvironment.SSLKeyRepository = @"D:\Cert\BB\key";
MQEnvironment.UserId = "user1";
MQEnvironment.properties.Add(MQC.TRANSPORT_PROPERTY, connectionType);
qMgr = new MQQueueManager();
我得到的错误:
消息="MQRC_Q_MGR_NAME_ERROR"
Message = "MQRC_Q_MGR_NAME_ERROR"
我也尝试通过telneting能够做到的服务器.
I also tried telneting the server which I am able to do.
可以帮助我在这里做错什么以及为什么收到此错误的信息.
Can some help me what is wrong I am doing here and why I am getting this error.
我通过设置以下env变量来解决这个问题.在连接之前.
I sloved the issue by setting following env varibles. before the connection.
环境变量是MQCHLLIB,MQCHLTAB,MQSSLKEYR-使用Environment.SetEnvironmentVariable-设置值
Env varibles are MQCHLLIB,MQCHLTAB,MQSSLKEYR - use Environment.SetEnvironmentVariable - to set values
<add key="MQ_SSL_CERT_PATH" value="D:\Cert\<nameof KDB with out .kdb>" />
<add key="MQ_CHANNEL_LIB" value="D:\Cert" /> --- Certs location.
<add key="MQ_CHANNEL_TAB" value="xxx.tab" />
<add key="NMQ_MQ_LIB" value="mqic.dll" /> - **Make sure you give the refarance of this DLL**
设置所有这些之后,只需调用queueManager = new MQQueueManager();即可. -你应该很好.
After setting all this just call queueManager = new MQQueueManager(); - You should be good.