MQTTnet
MQTTnet copied to clipboard
Maui Hybrid Android javax.net.ssl.SSLHandshakeException
Simple vanilla implementation using Maui Hybrid fails to manage the TLS handshake when run on android device or emulator with the following error:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
The same application works and connects the MQTTclient when compiled as a Maui Windows application.
Which component is your bug related to?
The MQTTnet Client
To Reproduce
Create a new MAUI Hybrid application
Use the following MqttClientOptionsBuilder...
_mqttClient = factory.CreateMqttClient();
_options = new MQTTnet.Client.MqttClientOptionsBuilder()
.WithClientId(clientId)
.WithTcpServer(server, port)
.WithCredentials(username, password)
.WithTlsOptions(new MqttClientTlsOptions()
{
UseTls = true,
SslProtocol = SslProtocols.Tls12,
AllowUntrustedCertificates = true,
IgnoreCertificateChainErrors = true,
IgnoreCertificateRevocationErrors = true
})
.Build();
and then connect using...
var connect = await _mqttClient.ConnectAsync(_options);
Debug or release as an android application and the exception is thrown on connect.
Debug or release as a windows application and the connection succeeds
Expected behavior
Connection should honour the following...
AllowUntrustedCertificates = true,
IgnoreCertificateChainErrors = true,
IgnoreCertificateRevocationErrors = true
and the client should connect
I have the same issue, the latest version(4.3.1.873) still has this problem. Can someone help us?
The code is the same for Android and Windows. So you might create a ticket at the MAUI project instead of this one.
same issue here +1
mesmo erro