Closed madtocc closed 5 years ago
Yes, using the iot-core example
lsException: Failure trusting builtin roots (OS Error: CERT_ALREADY_IN_HASH_TABLE(x509_lu.c:356), errno = 0)
Hi Steve, thanks for your prompt answer! 👍 Perfect, thanks!
@shamblett just a suggestion maybe you can set trustedCertPath to null on the function disconnect under mqtt_client.dart... it fixes this issue (: Cheers
I'm still having this issue with iot core, so when setting up the connection
ByteData data = await rootBundle.load("assets/pem/roots.pem");
var context = SecurityContext.defaultContext;
context.setTrustedCertificatesBytes(data.buffer.asUint8List());
but the next time it will try to setup the connection again, it will raise the issue. I tried "" and null
context.setTrustedCertificates("");
but I get that the path is not found, or that null is not supported. Any idea please how to solve it ?
thanks in advance
If the cert is already bset up Ok don't set it again, just comment the context.set.. out, this has worked for me in the past.
thanks a lot for your fast reply, do you how to do the check if it is already set or not ? in my case I have a method _setUpMqttClient
and I set the certificate at this level, so when I m back to the screen the _setUpMqttClient
is called if connection is lost.
I don't think I did, iot-home isn't a live package as such its more a demo project so I probably just commented the lines out when the error occurred on my test platform, I can't remember the details of it but you should be able to write a little Dart(or any other language for that matter) to set the certs once and then not call it in iot-home, not sure how you would make this portable from platform to platform though.
Whenever I loose my connection weather by disconnecting the broker, turning my wifi/data off or through calling disconnect() and I try to reconnect using client.connect I get an error due an existing certficate:
E/flutter ( 5332): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception: E/flutter ( 5332): TlsException: Failure trusting builtin roots (OS Error: E/flutter ( 5332): CERT_ALREADY_IN_HASH_TABLE(x509_lu.c:356), errno = 0) E/flutter ( 5332): #0 _SecurityContext.setTrustedCertificatesBytes (dart:io/runtime/binsecure_socket_patch.dart:171:59) E/flutter ( 5332): #1 MqttSecureConnection.connect (file:///Users/mt/Projects/flutter/mqtt_client/lib/src/connectionhandling/mqtt_client_mqtt_secure_connection.dart:56:19) E/flutter ( 5332): #2 SynchronousMqttConnectionHandler.internalConnect (file:///Users/mt/Projects/flutter/mqtt_client/lib/src/connectionhandling/mqtt_client_synchronous_mqtt_connection_handler.dart:53:24) E/flutter ( 5332):
E/flutter ( 5332): #3 MqttConnectionHandler.connect (file:///Users/mt/Projects/flutter/mqtt_client/lib/src/connectionhandling/mqtt_client_mqtt_connection_handler.dart:56:13)
E/flutter ( 5332):
E/flutter ( 5332): #4 MqttClient.connect (file:///Users/mt/Projects/flutter/mqtt_client/lib/src/mqtt_client.dart:165:37)
E/flutter ( 5332):
E/flutter ( 5332): #5 Mqtt.connect (package:mqtt/mqtt.dart:39:18)
E/flutter ( 5332):
I don't know if you are able to reproduce it without flutter...