MQTT SSL possible? · Issue #7 · OPEnSLab-OSU/SSLClient (original) (raw)
I've been trying for a long time with a lot of things but I can't get it to work, I don't even know if it is possible.
I would like to connect to a MQTT broker via TLS/SSL. I'm using EthernetLarge, SSLClient and pubsubclient with a SAMD21 board. No compile problems, but when I try to connect this appears:
(SSLClient)(SSL_INFO)(connect): Base client connected!
(SSLClient)(SSL_INFO)(m_run_until): m_run changed state:
(SSLClient)(SSL_INFO)(m_run_until): State:
RECVREC
(SSLClient)(SSL_INFO)(m_run_until): Expected bytes count:
(SSLClient)(SSL_INFO)(m_run_until): 5
(SSLClient)(SSL_INFO)(m_update_engine): Memory:
(SSLClient)(SSL_INFO)(m_update_engine): 9791
(SSLClient)(SSL_INFO)(m_update_engine): Memory:
(SSLClient)(SSL_INFO)(m_update_engine): 9791
(SSLClient)(SSL_INFO)(m_update_engine): Memory:
(SSLClient)(SSL_INFO)(m_update_engine): 9791
(SSLClient)(SSL_INFO)(m_update_engine): Memory:
(SSLClient)(SSL_INFO)(m_update_engine): 9791
(SSLClient)(SSL_WARN)(m_run_until): Terminating because the ssl engine closed
(SSLClient)(SSL_ERROR)(m_start_ssl): Failed to initlalize the SSL layer
(SSLClient)(SSL_ERROR)(m_print_br_error): Chain could not be linked to a trust anchor.
[MQTT](KO!): -2
(SSLClient)(SSL_ERROR)(connect): Cannot have two connections at the same time! Please create another SSLClient instance.
And the last SSL_ERROR message keeps repeating. On my server side a new connection appears but nothing else (mosquitto).
Part of the Arduino code:(...)
EthernetClient ethClient;
SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, A6, 1, SSLClient::SSL_INFO);
PubSubClient client(mqttServer, 8883, callback, ethClientSSL);
(...)
client.connect(clientId, usr, pass, willTopic, willQoS, willRetain, willMessage)
Any help will be very appreciated.