Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Unable to connect using SSL(Unable to connect using SSL)
Unable to connect using SSL [message #1826565] Mon, 27 April 2020 08:20
Arthur Blondel is currently offline Arthur BlondelFriend
Messages: 2
Registered: December 2019
Junior Member
Hello
I'm trying to connect with SSL but after a TCP connection, the client doesn't start any TLS.
This is my code:
mqtt::connect_options conopts;
conopts.set_user_name("username");
conopts.set_automatic_reconnect(1, 5);
mqtt::ssl_options ssl_opts(
    "Client_certificate.crt" , // trust_store
    "embeddedChain.crt",       // key_Store
    "Client_key.pem",          // private_Key
    "",                        // private_key_password
    "ALL",                     // enabled_cipher_suites
    false                      // enable_server_cert_auth
);
conopts.set_ssl(ssl_opts);
m_conntok = m_client->connect(conopts);


I don't understand the errors in 110913.801 and 110913.902

This is part of the MQTT log:
=========================================================
                   Trace Output
Product name: Eclipse Paho Asynchronous MQTT C Client Library
Version: 1.3.1
Build level: 2020-04-27T06:23:32Z
OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
OpenSSL flags: compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-kxN_24/openssl-1.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX2
OpenSSL build timestamp: built on: Tue Nov 12 16:58:35 2019 UTC
OpenSSL platform: platform: debian-amd64
OpenSSL directory: OPENSSLDIR: "/usr/lib/ssl"
/proc/version: Linux version 4.15.0-91-generic (buildd@lgw01-amd64-013) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020

=========================================================
19700101 020000.000 (866180480)  (1)> Socket_outInitialize:131
19700101 020000.000 (866180480)   (2)> SocketBuffer_initialize:94
19700101 020000.000 (866180480)   (2)< SocketBuffer_initialize:98
19700101 020000.000 (866180480)  (1)< Socket_outInitialize:144
19700101 020000.000 (866180480)  (1)> SSLSocket_initialize:446
19700101 020000.000 (866180480)   (2)> SSL_create_mutex:346
19700101 020000.000 (866180480)   (2)< SSL_create_mutex:352 (0)
19700101 020000.000 (866180480)   (2)> SSL_create_mutex:346
19700101 020000.000 (866180480)   (2)< SSL_create_mutex:352 (0)
19700101 020000.000 (866180480)  (1)< SSLSocket_initialize:492 (1)
19700101 020000.000 (866180480)  (1)> MQTTStrncpy:851
19700101 020000.000 (866180480)  (1)< MQTTStrncpy:861
19700101 020000.000 (866180480)  (1)> MQTTStrncpy:851
19700101 020000.000 (866180480)  (1)< MQTTStrncpy:861
19700101 020000.000 (866180480)  (1)> MQTTPersistence_create:52
19700101 020000.000 (866180480)  (1)< MQTTPersistence_create:98 (0)
19700101 020000.000 (866180480)  (1)> MQTTPersistence_initialize:113
19700101 020000.000 (866180480)  (1)< MQTTPersistence_initialize:121 (0)
19700101 020000.000 (866180480)  (1)> MQTTAsync_restoreCommands:1002
20200427 110913.697 0 commands restored for client HUX7PUAMH13507
20200427 110913.697 (866180480)  (1)< MQTTAsync_restoreCommands:1040 (0)
20200427 110913.697 (866180480)  (1)> MQTTPersistence_restoreMessageQueue:720
20200427 110913.697 0 queued messages restored for client HUX7PUAMH13507
20200427 110913.697 (866180480)  (1)< MQTTPersistence_restoreMessageQueue:759 (0)
20200427 110913.697 (866180480) (0)< MQTTAsync_createWithOptions:654 (0)
20200427 110913.697 (866180480) (0)> MQTTAsync_setConnected:2614
20200427 110913.697 (866180480) (0)< MQTTAsync_setConnected:2626 (0)
20200427 110913.697 (866180480) (0)> MQTTAsync_setCallbacks:2500
20200427 110913.697 (866180480) (0)< MQTTAsync_setCallbacks:2514 (0)
20200427 110913.697 (866180480) (0)> MQTTAsync_connect:2812
20200427 110913.697 (866180480)  (1)> UTF8_validateString:157
20200427 110913.697 (866180480)   (2)> UTF8_validate:131
20200427 110913.697 (866180480)   (2)< UTF8_validate:143 (1)
20200427 110913.697 (866180480)  (1)< UTF8_validateString:159 (1)
20200427 110913.697 (866180480)  (1)> Thread_start:69
20200427 110913.697 (866180480)  (1)< Thread_start:79
20200427 110913.697 (866180480)  (1)> Thread_start:69
20200427 110913.697 (866180480)  (1)< Thread_start:79
20200427 110913.697 (866180480)  (1)> MQTTStrncpy:851
20200427 110913.698 (866180480)  (1)< MQTTStrncpy:861
20200427 110913.698 (866180480)  (1)> MQTTStrncpy:851
20200427 110913.698 (866180480)  (1)< MQTTStrncpy:861
20200427 110913.698 (866180480)  (1)> MQTTStrncpy:851
20200427 110913.698 (866180480)  (1)< MQTTStrncpy:861
20200427 110913.698 (866180480)  (1)> MQTTStrncpy:851
20200427 110913.698 (866180480)  (1)< MQTTStrncpy:861
20200427 110913.698 (866180480)  (1)> MQTTStrncpy:851
20200427 110913.698 (866180480)  (1)< MQTTStrncpy:861
20200427 110913.698 (866180480)  (1)> MQTTAsync_addCommand:1050
20200427 110913.698 (866180480)   (2)> Thread_signal_cond:395
20200427 110913.698 (866180480)   (2)< Thread_signal_cond:400 (0)
20200427 110913.698 (866180480)  (1)< MQTTAsync_addCommand:1084 (0)
20200427 110913.698 (866180480) (0)< MQTTAsync_connect:3119 (0)
20200427 110913.698 (829785856) (0)> MQTTAsync_receiveThread:2138
20200427 110913.698 (829785856)  (1)> MQTTAsync_cycle:3740
20200427 110913.698 (829785856)   (2)> Socket_getReadySocket:237
20200427 110913.698 (829785856)   (2)< Socket_getReadySocket:309 (0)
20200427 110913.698 (829785856)   (2)> MQTTAsync_sleep:440
20200427 110913.698 (838178560) (0)> MQTTAsync_sendThread:1858
20200427 110913.699 (838178560)  (1)> MQTTAsync_processCommand:1398
20200427 110913.699 Connecting to serverURI 127.0.0.1:1883 with MQTT version 4
20200427 110913.699 (838178560)   (2)> MQTTProtocol_connect:114
20200427 110913.699 (838178560)    (3)> MQTTProtocol_addressPort:58
20200427 110913.699 (838178560)    (3)< MQTTProtocol_addressPort:90
20200427 110913.699 (838178560)    (3)> Socket_new:668
20200427 110913.699 New socket 17 for 127.0.0.1:1883, port 1883
20200427 110913.699 (838178560)     (4)> Socket_addSocket:173
20200427 110913.699 (838178560)      (5)> Socket_setnonblocking:85
20200427 110913.699 (838178560)      (5)< Socket_setnonblocking:90 (0)
20200427 110913.699 (838178560)     (4)< Socket_addSocket:196 (0)
20200427 110913.699 Connect pending
20200427 110913.699 (838178560)    (3)< Socket_new:785 (115)
20200427 110913.699 (838178560)   (2)< MQTTProtocol_connect:156 (115)
20200427 110913.699 (838178560)   (2)> MQTTProperties_free:366
20200427 110913.699 (838178560)   (2)< MQTTProperties_free:389
20200427 110913.699 (838178560)  (1)< MQTTAsync_processCommand:1734 (1)
20200427 110913.699 (838178560)  (1)> Thread_wait_cond:413
20200427 110913.699 (829785856)   (2)< MQTTAsync_sleep:446
20200427 110913.699 (829785856)   (2)> MQTTAsync_retry:3573
20200427 110913.800 (829785856)    (3)> MQTTProtocol_keepalive:608
20200427 110913.800 (829785856)    (3)< MQTTProtocol_keepalive:644
20200427 110913.800 (829785856)    (3)> MQTTProtocol_retry:730
20200427 110913.800 (829785856)    (3)< MQTTProtocol_retry:749
20200427 110913.800 (829785856)   (2)< MQTTAsync_retry:3583
20200427 110913.800 (829785856)  (1)< MQTTAsync_cycle:3891 (-1)
20200427 110913.800 (829785856)  (1)> MQTTAsync_cycle:3740
20200427 110913.800 (829785856)   (2)> Socket_getReadySocket:237
20200427 110913.800 (829785856)    (3)> Socket_continueWrites:928
20200427 110913.800 (829785856)    (3)< Socket_continueWrites:952 (0)
20200427 110913.800 (829785856)    (3)> isReady:213
20200427 110913.800 (829785856)    (3)< isReady:218 (1)
20200427 110913.800 (829785856)   (2)< Socket_getReadySocket:309 (17)
20200427 110913.800 m->c->connect_state = 1
20200427 110913.800 (829785856)   (2)> MQTTAsync_connecting:3591
20200427 110913.800 (829785856)    (3)> MQTTProtocol_addressPort:58
20200427 110913.800 (829785856)    (3)< MQTTProtocol_addressPort:90
20200427 110913.800 (829785856)    (3)> SSLSocket_setSocketForSSL:686
20200427 110913.800 (829785856)     (4)> SSLSocket_createContext:545
20200427 110913.800 (829785856)      (5)> SSLSocket_error:100
20200427 110913.801 SSLSocket error (185073780) in SSL_CTX_use_PrivateKey_file for socket 17 rc 0 errno 2 No such file or directory

20200427 110913.801 (829785856)      (5)< SSLSocket_error:120 (185073780)
20200427 110913.801 (829785856)     (4)< SSLSocket_createContext:676 (0)
20200427 110913.801 (829785856)    (3)< SSLSocket_setSocketForSSL:725 (0)
20200427 110913.801 (829785856)    (3)> nextOrClose:1741
20200427 110913.801 (829785856)     (4)> MQTTAsync_checkConn:526
20200427 110913.801 (829785856)     (4)< MQTTAsync_checkConn:529 (1)
20200427 110913.801 (829785856)     (4)> MQTTAsync_closeOnly:2633
20200427 110913.801 (829785856)      (5)> MQTTProtocol_checkPendingWrites:1208
20200427 110913.801 (829785856)      (5)< MQTTProtocol_checkPendingWrites:1225
20200427 110913.801 (829785856)      (5)> WebSocket_close:407
20200427 110913.801 (829785856)      (5)< WebSocket_close:460
20200427 110913.801 (829785856)      (5)> SSLSocket_close:910
20200427 110913.801 (829785856)       (6)> SSLSocket_destroyContext:897
20200427 110913.801 (829785856)       (6)< SSLSocket_destroyContext:901
20200427 110913.801 (829785856)      (5)< SSLSocket_close:922 (1)
20200427 110913.801 (829785856)      (5)> Socket_close:613
20200427 110913.801 (829785856)       (6)> Socket_close_only:587
20200427 110913.801 (829785856)       (6)< Socket_close_only:601 (0)
20200427 110913.801 (829785856)       (6)> Socket_abortWrite:895
20200427 110913.801 (829785856)       (6)< Socket_abortWrite:913 (0)
20200427 110913.801 (829785856)       (6)> SocketBuffer_cleanup:136
20200427 110913.801 (829785856)       (6)< SocketBuffer_cleanup:148
20200427 110913.801 Removed socket 17
20200427 110913.801 (829785856)      (5)< Socket_close:640
20200427 110913.801 (829785856)     (4)< MQTTAsync_closeOnly:2655
20200427 110913.801 Connect failed, more to try
20200427 110913.801 (829785856)     (4)> MQTTAsync_addCommand:1050
20200427 110913.801 (829785856)      (5)> Thread_signal_cond:395
20200427 110913.801 (829785856)      (5)< Thread_signal_cond:400 (0)
20200427 110913.801 (829785856)     (4)< MQTTAsync_addCommand:1084 (0)
20200427 110913.801 (829785856)    (3)< nextOrClose:1794
20200427 110913.801 (829785856)   (2)< MQTTAsync_connecting:3730 (-1)
20200427 110913.801 (829785856)   (2)> MQTTAsync_retry:3573
20200427 110913.801 (829785856)    (3)> MQTTProtocol_retry:730
20200427 110913.801 (829785856)    (3)< MQTTProtocol_retry:749
20200427 110913.801 (829785856)   (2)< MQTTAsync_retry:3583
20200427 110913.801 (829785856)  (1)< MQTTAsync_cycle:3891 (-1)
20200427 110913.801 Could not find client corresponding to socket 17
20200427 110913.801 (829785856)  (1)> MQTTAsync_cycle:3740
20200427 110913.801 (829785856)   (2)> Socket_getReadySocket:237
20200427 110913.801 (829785856)   (2)< Socket_getReadySocket:309 (0)
20200427 110913.801 (829785856)   (2)> MQTTAsync_sleep:440
20200427 110913.801 (838178560)  (1)< Thread_wait_cond:421 (0)
20200427 110913.801 (838178560)  (1)> MQTTAsync_checkTimeouts:1804
20200427 110913.801 (838178560)  (1)< MQTTAsync_checkTimeouts:1852
20200427 110913.801 (838178560)  (1)> MQTTAsync_processCommand:1398
20200427 110913.801 Connecting to serverURI 127.0.0.1:1883 with MQTT version 3
20200427 110913.801 (838178560)   (2)> MQTTProtocol_connect:114
20200427 110913.801 (838178560)    (3)> MQTTProtocol_addressPort:58
20200427 110913.801 (838178560)    (3)< MQTTProtocol_addressPort:90
20200427 110913.801 (838178560)    (3)> Socket_new:668
20200427 110913.801 New socket 17 for 127.0.0.1:1883, port 1883
20200427 110913.801 (838178560)     (4)> Socket_addSocket:173
20200427 110913.801 (838178560)      (5)> Socket_setnonblocking:85
20200427 110913.801 (838178560)      (5)< Socket_setnonblocking:90 (0)
20200427 110913.801 (838178560)     (4)< Socket_addSocket:196 (0)
20200427 110913.801 Connect pending
20200427 110913.801 (838178560)    (3)< Socket_new:785 (115)
20200427 110913.801 (838178560)   (2)< MQTTProtocol_connect:156 (115)
20200427 110913.802 (838178560)   (2)> MQTTProperties_free:366
20200427 110913.802 (838178560)   (2)< MQTTProperties_free:389
20200427 110913.802 (838178560)  (1)< MQTTAsync_processCommand:1734 (1)
20200427 110913.802 (838178560)  (1)> Thread_wait_cond:413
20200427 110913.802 (829785856)   (2)< MQTTAsync_sleep:446
20200427 110913.802 (829785856)   (2)> MQTTAsync_retry:3573
20200427 110913.802 (829785856)    (3)> MQTTProtocol_retry:730
20200427 110913.802 (829785856)    (3)< MQTTProtocol_retry:749
20200427 110913.802 (829785856)   (2)< MQTTAsync_retry:3583
20200427 110913.802 (829785856)  (1)< MQTTAsync_cycle:3891 (-1)
20200427 110913.802 (829785856)  (1)> MQTTAsync_cycle:3740
20200427 110913.802 (829785856)   (2)> Socket_getReadySocket:237
20200427 110913.802 (829785856)    (3)> Socket_continueWrites:928
20200427 110913.802 (829785856)    (3)< Socket_continueWrites:952 (0)
20200427 110913.802 (829785856)    (3)> isReady:213
20200427 110913.802 (829785856)    (3)< isReady:218 (1)
20200427 110913.802 (829785856)   (2)< Socket_getReadySocket:309 (17)
20200427 110913.802 m->c->connect_state = 1
20200427 110913.802 (829785856)   (2)> MQTTAsync_connecting:3591
20200427 110913.802 (829785856)    (3)> MQTTProtocol_addressPort:58
20200427 110913.902 (829785856)    (3)< MQTTProtocol_addressPort:90
20200427 110913.902 (829785856)    (3)> SSLSocket_setSocketForSSL:686
20200427 110913.902 (829785856)     (4)> SSLSocket_createContext:545
20200427 110913.902 (829785856)      (5)> SSLSocket_error:100
20200427 110913.902 SSLSocket error (185073780) in SSL_CTX_use_PrivateKey_file for socket 17 rc 0 errno 11 Resource temporarily unavailable

20200427 110913.902 (829785856)      (5)< SSLSocket_error:120 (185073780)
20200427 110913.902 (829785856)     (4)< SSLSocket_createContext:676 (0)
20200427 110913.902 (829785856)    (3)< SSLSocket_setSocketForSSL:725 (0)
20200427 110913.902 (829785856)    (3)> nextOrClose:1741
20200427 110913.902 (829785856)     (4)> MQTTAsync_checkConn:526
20200427 110913.902 (829785856)     (4)< MQTTAsync_checkConn:529 (0)
20200427 110913.902 (829785856)     (4)> MQTTAsync_closeSession:2661
20200427 110913.902 (829785856)      (5)> MQTTAsync_closeOnly:2633
20200427 110913.902 (829785856)       (6)> MQTTProtocol_checkPendingWrites:1208
20200427 110913.902 (829785856)       (6)< MQTTProtocol_checkPendingWrites:1225
20200427 110913.902 (829785856)       (6)> WebSocket_close:407
20200427 110913.902 (829785856)       (6)< WebSocket_close:460
20200427 110913.902 (829785856)       (6)> SSLSocket_close:910
20200427 110913.902 (829785856)        (7)> SSLSocket_destroyContext:897
20200427 110913.902 (829785856)        (7)< SSLSocket_destroyContext:901
20200427 110913.903 (829785856)       (6)< SSLSocket_close:922 (1)
20200427 110913.903 (829785856)       (6)> Socket_close:613
20200427 110913.903 (829785856)        (7)> Socket_close_only:587
20200427 110913.903 (829785856)        (7)< Socket_close_only:601 (0)
20200427 110913.903 (829785856)        (7)> Socket_abortWrite:895
20200427 110913.903 (829785856)        (7)< Socket_abortWrite:913 (0)
20200427 110913.903 (829785856)        (7)> SocketBuffer_cleanup:136
20200427 110913.903 (829785856)        (7)< SocketBuffer_cleanup:148
20200427 110913.903 Removed socket 17
20200427 110913.903 (829785856)       (6)< Socket_close:640
20200427 110913.903 (829785856)      (5)< MQTTAsync_closeOnly:2655
20200427 110913.903 (829785856)      (5)> MQTTAsync_cleanSession:2690
20200427 110913.903 (829785856)       (6)> MQTTPersistence_clear:160
20200427 110913.903 (829785856)       (6)< MQTTPersistence_clear:164 (0)
20200427 110913.903 (829785856)       (6)> MQTTProtocol_emptyMessageList:812
20200427 110913.903 (829785856)       (6)< MQTTProtocol_emptyMessageList:821
20200427 110913.903 (829785856)       (6)> MQTTProtocol_emptyMessageList:812
20200427 110913.903 (829785856)       (6)< MQTTProtocol_emptyMessageList:821
20200427 110913.903 (829785856)       (6)> MQTTAsync_emptyMessageQueue:1894
20200427 110913.903 (829785856)       (6)< MQTTAsync_emptyMessageQueue:1908
20200427 110913.904 (829785856)       (6)> MQTTAsync_removeResponsesAndCommands:1918
20200427 110913.904 0 responses removed for client HUX7PUAMH13507
20200427 110913.904 0 commands removed for client HUX7PUAMH13507
20200427 110913.904 (829785856)       (6)< MQTTAsync_removeResponsesAndCommands:2003
20200427 110913.904 (829785856)      (5)< MQTTAsync_cleanSession:2706 (0)
20200427 110913.904 (829785856)     (4)< MQTTAsync_closeSession:2668
20200427 110913.904 Calling connect failure for client HUX7PUAMH13507
20200427 110913.904 (829785856)    (3)< nextOrClose:1794
20200427 110913.904 (829785856)   (2)< MQTTAsync_connecting:3730 (-1)



I have the same problem with key_Store set to "Client_key.pem" and private_Key sot to ""

Thanks
Previous Topic:New Service Release of Paho MQTT Java Client library
Next Topic:Non SSL connection with paho-mqttas lib
Goto Forum:
  


Current Time: Fri Oct 30 07:54:44 GMT 2020

Powered by FUDForum. Page generated in 0.02841 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top