fluffysquirrels / mqtt-async-client-rs

An MQTT client written in Rust
MIT License
40 stars 16 forks source link

Add tls client certificate parameters to example #24

Closed marcelbuesing closed 3 years ago

marcelbuesing commented 3 years ago

Add parameters for TLS client authentication.

Notice, this may lead to the following error: mqtt_async_client::client::client] IoTask: Error connecting: invalid certificate: BadDER. Not sure if this is related to my cert setup yet or a general rustls issue, similar issue is described here, dirty workaround here.

fluffysquirrels commented 3 years ago

Your code seems correct, so I've merged it.

rustls errors can be a little hard to track down. Can you add some example client certificates that seem to cause a problem? That would help us reproduce the issue.

marcelbuesing commented 3 years ago

So issues I ran into were basically when following this guide that openssl generates x.509 version 1 certificates which are not supported by rustls. Next I ran into issues with self signed certificates. I just created this client / server example.

fluffysquirrels commented 3 years ago

I haven't had time to look at your example yet, but one way I have had success is by using the scripts included in the rustls tree.