0

我目前正在使用 activemq-cpp c++​​ 客户端连接到后端服务器。使用 TCP 协议时,可以进行通信。我在https://activemq.apache.org/components/cms/example使用上面的示例。但现在我需要使用 SSL 协议。我的代码如下:

brokerURI ="故障转移:(ssl://xxxx:61617)";

auto connectionFactory = new ActiveMQConnectionFactory(brokerURI);

connectionFactory->setUsername(用户名);

connectionFactory->setPassword(密码);

连接=连接工厂->创建连接();

连接->开始();

我陷入了启动功能,没有抛出任何异常。我不知道为什么。能给我一个简单的c++ ssl代码连接demo让我学习吗?谢谢你。

4

1 回答 1

0

[example][1] 记录了您需要执行的 SSL 配置,即告诉库密钥存储和信任存储(和密码)所在的位置。

// SSL:
// =========================
// To use SSL you need to specify the location of the trusted Root CA or the
// certificate for the broker you want to connect to.  Using the Root CA allows
// you to use failover with multiple servers all using certificates signed by
// the trusted root.  If using client authentication you also need to specify
// the location of the client Certificate.
//
//     System::setProperty( "decaf.net.ssl.keyStore", "<path>/client.pem" );
//     System::setProperty( "decaf.net.ssl.keyStorePassword", "password" );
//     System::setProperty( "decaf.net.ssl.trustStore", "<path>/rootCA.pem" );
//
// The you just specify the ssl transport in the URI, for example:
//
//     ssl://localhost:61617
//
于 2019-05-09T19:23:00.863 回答