【问题标题】:activemq-cpp c++ client how to use ssl url to connect serveractivemq-cpp c++​​客户端如何使用ssl url连接服务器
【发布时间】:2019-09-27 02:21:35
【问题描述】:

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

brokerURI ="failover:(ssl://xxxx:61617)";

auto connectionFactory = new ActiveMQConnectionFactory(brokerURI);

connectionFactory->setUsername(用户名);

connectionFactory->setPassword(密码);

connection = connectionFactory->createConnection();

连接->start();

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

【问题讨论】:

    标签: ssl activemq-cpp


    【解决方案1】:

    [示例][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
    //
    

    【讨论】:

    • 非常感谢您的帮助。我的工作环境是WIN10。我可以使用 telnet 工具直接连接到 ssl 地址。 E.g telnet xxxx(ssl address) 你能告诉我这个activemq-cpp必须有证书才能连接吗?我这里目前没有证书,只有一个ssl连接地址
    • 因为 SSL 就是这样工作的,没有证书它只是不安全的 TCP。
    猜你喜欢
    • 1970-01-01
    • 2014-12-12
    • 2010-10-17
    • 1970-01-01
    • 2012-05-22
    • 2021-01-28
    • 2023-04-09
    • 1970-01-01
    • 2020-01-27
    相关资源
    最近更新 更多