I'm trying to enable tls in the mqtt communication.
Below what I'm doing... let me cut the code that I believe is not important.
With MQTTSpy, from a workstation, I can connect to the mqtt broker, using the same certificates and parameters.
With the ESP01, it crashes at the beginning.
What I'm doing wrong? How can I debug the issue?
Do you have suggestions?
At the beginning I load the certificates
#include "certificates.h"
Then I instantiate the pubsubclient client
WiFiClientSecure espClient;
PubSubClient client(espClient);and finally I try to estabilish the connection
espClient.setCertificate(certificates_sensor3_bin_crt, certificates_sensor3_bin_crt_len);
espClient.setPrivateKey(certificates_sensor3_bin_key, certificates_sensor3_bin_key_len);
client.setClient(espClient);
client.setServer(mqtt_server,mqtt_server_port);This is the certificates.h
unsigned char certificates_sensor3_bin_crt[] = {
0x30, 0x82, 0x03, 0x7f, 0x30, 0x82, 0x02, 0x67, 0x02, 0x09, 0x00, 0xa9,
0x7a, 0xed, 0xe7, 0xf9, 0xde, 0xa8, 0x14, 0x30, 0x0d, 0x06, 0x09, 0x2a,
<CUT>
0xd6, 0xac, 0x96, 0x22, 0x63, 0x74, 0xba, 0x69, 0xd6, 0x6c, 0xa9, 0xa5,
0xbd, 0xc5, 0x19, 0x14, 0x99, 0x57, 0xe0, 0x46, 0x28, 0xde, 0x32
};
unsigned int certificates_sensor3_bin_crt_len = 899;
unsigned char certificates_sensor3_bin_key[] = {
0x30, 0x82, 0x04, 0xa5, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
0xbd, 0x8e, 0xfa, 0x35, 0xcd, 0x6a, 0xf8, 0xc8, 0x16, 0xb3, 0xd3, 0xfb,
0x14, 0xf6, 0x38, 0x9f, 0x6b, 0x86, 0x8e, 0xf3, 0xb7, 0x27, 0xb6, 0x66,
<CUT>
0x97, 0x3d, 0xea, 0x52, 0x31, 0xd6, 0xf9, 0x4c, 0x48, 0x55, 0x82, 0x7d,
0x44, 0xe9, 0xbc, 0xa0, 0x20
};
unsigned int certificates_sensor3_bin_key_len = 1193;