如何使用C客户端启用ActiveMQ SSL身份验证

时间:2017-01-07 10:14:32

标签: c++ ssl activemq mqtt

我正在尝试使用ssl将C客户端与activeMQ连接。为此,我使用以下link创建了证书。 我还将activeMQ与传输连接器混合为:

<transportConnector name="ssl" uri="mqtt+ssl://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>  

C客户端uisng SSL的部分如下:

MQTTClient_SSLOptions ssl_opts = MQTTClient_SSLOptions_initializer; 
ssl_opts.enableServerCertAuth = 0; 
conn_opts.ssl = &ssl_opts; 
conn_opts.ssl->keyStore = "/home/user/certs/client-chain.pem"; 
conn_opts.ssl->privateKeyPassword = "password"; 
conn_opts.ssl->enabledCipherSuites = "DEFAULT"; 
MQTTClient_setCallbacks(client, NULL, connlost, msgarrvd, delivered); 
if ((rc = MQTTClient_connect(client, &conn_opts))!=MQTTCLIENT_SUCCESS) 
{ 
 printf("%d",rc);
} 

但是当我将C客户端连接到activeMQ时,我得到连接失败返回代码-1错误...请帮助我解决此问题

0 个答案:

没有答案