Reputation: 2167
I am trying to connect to the remote queues using secured SSL connection. I have all the details provided by third party regarding SSL connection and Queue Manager details. I have V8 version of MQ client installed on my windows machine.
SSL folder that thirdparty has shared contains jks,kdb,rdb and sth files.
I am using below code to initialize the properties in .net console application
const string SslKeyRepository = @"ssl folder location with key name included";
const string CipherSpec = "TLS_RSA_WITH_3DES_EDE_CBC_SHA";
const string CipherSuite = "SSL_RSA_WITH_3DES_EDE_CBC_SHA";
const string SslPeerName = "Peername";
const string ConnectionType = MQC.TRANSPORT_MQSERIES_CLIENT;
static Hashtable init(String connectionType)
{
Hashtable connectionProperties = new Hashtable
{
{MQC.TRANSPORT_PROPERTY, connectionType},
{MQC.PORT_PROPERTY, 1496},
{MQC.SSL_CERT_STORE_PROPERTY, SslKeyRepository},
{MQC.SSL_CIPHER_SPEC_PROPERTY, CipherSpec},
{MQC.SSL_PEER_NAME_PROPERTY, $"CN=\"{SslPeerName}\""}
};
// Add the connection type
// SSL
// Set up the rest of the connection properties, based on the
// connection type requested
switch (connectionType)
{
case MQC.TRANSPORT_MQSERIES_BINDINGS:
break;
case MQC.TRANSPORT_MQSERIES_CLIENT:
case MQC.TRANSPORT_MQSERIES_XACLIENT:
case MQC.TRANSPORT_MQSERIES_MANAGED:
connectionProperties.Add(MQC.HOST_NAME_PROPERTY, HostName);
connectionProperties.Add(MQC.CHANNEL_PROPERTY, Channel);
break;
}
return connectionProperties;
}
I have tried few things but I end up getting exception "MQRC_SSL_INITIALIZATION_ERROR"
I would appreciate if you can help me with this.
Upvotes: 2
Views: 1678
Reputation: 31832
There are many reasons for MQRC_SSL_INITIALIZATION_ERROR
. Some of them are mechanical issues such as whether the keystore files can be accessed. Some are procedural such as whether the handshake fails. The best way to diagnose is methodically checking the configuration and then performing differential testing.
For the first part of this, perform the following checks. If you have already done so, don't cut corners. Do it again.
runmqakm -cert -list
against the KDB to verify that it is structurally intact and the stash file is present with the proper password.runmqakm -cert -details
to verify that the certificate(s) corresponding to the queue manager is/are present and the details. If the QMgr uses a self-signed cert there will be only one. If the QMgr uses a CA-signed cert there should be an intermediate and a root signer.SSLCAUTH(OPTIONAL)
or SSLCAUTH(REQUIRED)
. If OPTIONAL
then the KDB should have no personal certs, only signers. If REQUIRED
then the KDB must have a personal cert and the label must be ibmwebspheremq[serviceaccount]
in lower case. For the differential testing, try some of the following tests:
amqsputc
or amqsgetc
, depending on whether the real app is supposed to have PUT
or GET
on the queue. These use the same KDB, samme certs, etc. the main difference being they are known-good code.SSLCAUTH(OPTIONAL)
set at the QMgr. This demonstrates that the client can validate the QMgr's cert.SSLCAUTH(REQUIRED)
set at the QMgr and a personal cert in the local KDB. This demonstrates that the QMgr can validate the client's cert.SSLPEER
locally to filter on the QMgr cert's DN.If these don't help, please update the question with detailed results of your testing. The most common issues include cert labels and KDB permissions. If the business partner gave you the JKS and KDB, these should generally not come with a personal cert, only trusted certs.
Upvotes: 1