Maui Hybrid Android javax.net.ssl.SSLHandshakeException
- Dominant language
- C#
- Stars
- 5.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.