-
Notifications
You must be signed in to change notification settings - Fork 13.3k
SecureWifiClient::verify always returning false after MQTT connected #2125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you please post the part of the sketch where you are passing host name to mqttClient? |
WiFiClientSecure wifiClientSecure;
WiFiClient wifiClient;
PubSubClient mqttClient;
void setupMqtt() {
mqttClient = PubSubClient(
// config.mqttHost,
// "192.168.2.1",
"iotmqtt.cantireinnovations.com",
// config.mqttPort,
8883,
mqttCallback,
// wifiClient
wifiClientSecure
);
logger.print( "Connecting to " );
logger.print( config.mqttHost );
logger.print( ":" );
logger.print( config.mqttPort );
logger.print( " as " );
logger.println( config.userDeviceId );
} |
Okay, the issue comes from the fact that you can only call WiFiClientSecure::verify after WiFiClientSecure::connect has finished and before any read/write calls have been done. It appears that PubSubClient::connect does some reading and writing, so you can not call
|
Actually, given the fact that MQTT handshake is quite short, we can work around this issue. Instead of purging X.509 certificates on read/write operations, we can purge them lazily, if more memory is needed for fragment buffer. I have checked that this fixes verification issue. Edit: should be fixed in 0f0386e. |
Basic Info
Hardware
Hardware: ESP-12
Core Version: 2.3.0-rc1
Description
When I attempt to verify WifiClientSecure connection, after connecting to an MQTT server using https://github.com/CanTireInnovations/pubsubclient, I always get a
false
result, even when the fingerprint provided matches what's on the certificate. Using 2.2.0 instead of 2.3.0-rc1 results in the correct behaviour.The server I'm connecting to in the sketch below is
iotmqtt.cantireinnovations.com
on port 8883. The commands I ran to fetch the fingerprint were:Settings in IDE
Module: Adafruit Huzzah ESP8266
Flash Size: 4MB
CPU Frequency: 80Mhz
Upload Using: SERIAL
Sketch
Debug Messages
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: