dotnet / MQTTnet

MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
MIT License
4.42k stars 1.06k forks source link

Is there a sample code that utilizes TLS and can connect to AWS? #1885

Open xyderos opened 10 months ago

xyderos commented 10 months ago

Describe your question

I have been trying to set up MQTTNet to work with .pfx files as well as .crt files.

I have set up mosquitto to use TLS 1.3 and it seamlessly works with the test sub and test pub commands (please note that the test clients do not support .pfx files) with some mock certificates I made (ca, client, server)

I am able to both publish and subscribe to the broker.

I saw that in order to connect to the AWS, I need to have the .crt of the root (have it and works) as well as the .pfx certificate (got it, generated via openssl).

Is there a clean, concrete and consise way (eg snippet) in order to establish connection to the local broker?

I am trying locally since I want to mock the environment as close to production as possible.

Which project is your question related to?

CedreLo commented 9 months ago

any news on this ?

rido-min commented 9 months ago

not sure about AWS, but you can look at this sample https://github.com/Azure-Samples/MqttApplicationSamples/tree/main/scenarios/getting_started#fly-configure-mosquitto showing to connect to Mosquitto using a CAFile (the .crt) and a client certificate (pfx, or pem+key)