MQTT TLS find cipher and protocol used
I have been playing with the MQTT simpleclient example and have been able to get a secure connection to a remote MQTT broker. It would be nice to find out the cipher and protocol version (1.2 or 1.3) that was decided during the handshake but I can’t see any way of getting it?
I have tried getting this after a connect:
QSslConfiguration c = QSslConfiguration::defaultConfiguration();
qDebug() << "Protocol:" << c.protocol();
qDebug() << "Session Cipher:" << c.sessionCipher();
qDebug() << "Session Protocol:" << c.sessionProtocol();
But it’s all empty. QSslSocket seems to have some interesting properties but I can’t see a way to get the instance of this that the QMqttClient is using. QSslConfiguration doesn’t seem to be correct.
I’m guessing this is something to do with the underlying SSL backend (OpenSSL in my case) doing all this during the handshake?
It might also be nice to get some information about the downloaded SSL certificate that the broker provided such as expiry date etc.
Read more here: Source link
