Original Message:
Sent: Tue April 16, 2024 04:35 PM
From: Satheesh N
Subject: MQ Connectivity Issue (Exception - MQRC_SSL_INITIALIZATION_ERROR) in .Net code
Hi Francois,
We have "MY_CERT_COMMON_NAME" setup as the ssl peer in the queue manager/channel.
And I have the cert available in my user's cert manager, which match to the ssl peer name in the server. "CN=MY_CERT_COMMON_NAME"
We are able to connect to the same queue manager & queues using Java. The java code reads the specific cert file from the resources folder. But in .NET we point to the user's cert, where we have more than one cert. I thought cf.SetStringProperty(XMSC.WMQ_SSL_PEER_NAME, "CN=MY_CERT_COMMON_NAME") point the .NET code to pick the correct cert file and send to server for ssl peer validation.
--------------------
Java Code that works
--------------------
private static void checkMqConnectivity() {
String keyStoreFilename = "myCert.pfx";
String keystorePwd="MyKeystorePassword";
MQQueueManager mqManager = null;
SSLContext sslContext = SSLContextBuilder.create()
.loadKeyMaterial(KeyStoreFileService.getKeyStoreFile(), //This method load the cert file in resources folder.
keystorePwd.toCharArray(), keystorePwd.toCharArray())
.build();
System.setProperty("com.ibm.mq.cfg.useIBMCipherMappings", "false");
MQEnvironment.channel = "MY.CHANNEL.NAME";
MQEnvironment.hostname = "my.org.net";
MQEnvironment.port = "62318";
MQEnvironment.sslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA256";
MQEnvironment.sslSocketFactory = sslContext.getSocketFactory();
mqManager = new MQQueueManager("MY_QMGR");
}
------------------------------
Satheesh N
------------------------------
Original Message:
Sent: Fri April 12, 2024 03:55 AM
From: Francois Brandelik
Subject: MQ Connectivity Issue (Exception - MQRC_SSL_INITIALIZATION_ERROR) in .Net code
Hi Satesh,
This is where things go wrong:
cf.SetStringProperty(XMSC.WMQ_SSL_PEER_NAME, "CN=MY_CERT_COMMON_NAME");
What you need here is not your cert's information (client), but the qmgr's cert's information....
Hope it helps
------------------------------
Francois Brandelik