Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] SSL Connection error using paho C client

Hi Adam,

That looks a lot like the problem you might have if you app was linked with the non TLS supporting paho library. I think it's libpaho-mqtt3cs.so you need, you can build against the non s version as the api is the same, but it doesn't check for the ssl:// prefix on the host and passes the whole string through which results in the "not a valid IP address" error.

Al

On 12/08/15 13:40, Adam Scally wrote:
Hi,

I am getting an error when I try to make a SSL connection with the paho
C client. I am using the mosquito broker (V 1.4.2) and have created
self-signed certificates on the server with OpenSSL. I am using the
mosquitto sub/pub functions on my local machine which worked but the
Paho Client doesn't seem to be working. Here are some lines of my source
code:

     MQTTClient client;

     MQTTClient_connectOptions conn_opts =
MQTTClient_connectOptions_initializer;

     MQTTClient_SSLOptions sslopts = MQTTClient_SSLOptions_initializer;

     int rc;

     while (1)

     {

         MQTTClient_create(&client, “ssl://10.10.13.70:8883”, CLIENT_ID,

             MQTTCLIENT_PERSISTENCE_NONE, NULL);

         conn_opts.keepAliveInterval = “60”;

         conn_opts.cleansession = “0”;

         conn_opts.reliable = “1”;

         if (username != "")

             conn_opts.username = “username”;

         if (password != "")

             conn_opts.password = “password”;

         conn_opts.connectTimeout = “60”;

         conn_opts.retryInterval = “10”;

                 sslopts.enabledCipherSuites = “TLSv1”;

sslopts.trustStore="mqtt-ca.pem";

             sslopts.keyStore=keyStore;

             sslopts.privateKey=privateKey;

         sslopts.privateKeyPassword = “passphrase”;

                 sslopts.enableServerCertAuth = 0;

         conn_opts.ssl = &sslopts;

                 if ((rc = MQTTClient_connect(client, &conn_opts)) ==
MQTTCLIENT_SUCCESS)

           {

             std::cout << "Connection Success";

                     break;

                   }

     }

When I start my program here are the error messages I am getting:
rc: -1

20150812 130313.023 getaddrinfo failed for addr ssl://10.10.13.70 with rc -2

20150812 130313.023 ssl://10.10.13.70 is not a valid IP address

I know a similar error was reported with the asynchronous connection
options but working off the solution, I’m still getting an error.

I would be grateful to anyone who could help or point me in the right
direction. Thanks.

Regards,

Adam



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



Back to the top