Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » MQTT using SSL(Problem Connecting to Broker When Using SSL)
MQTT using SSL [message #1779879] Mon, 15 January 2018 09:36
Marcel Ball is currently offline Marcel BallFriend
Messages: 1
Registered: January 2018
Junior Member
Hi,

I'm am trying to connect to an embedded mosquitto broker using a C# application using the Paho M2MQTT library. I have no problem connecting if I don't use SSL but when I set SSL to true I throw an invalid certificate exception.

I can connect using MQTTFx and the same certificate I am using with my application so I know there is nothing wrong with the certificate or the setup of the broker.

M2MQTT version: 4.3.0
DotNet version: 4.5
Mosquitto version: 1.4.14
MQTTFx versdion: 1.0.0

Below is a snippet of the code I am using:

public const String MQTT_BRIDGE_USER = "EWS_FM80_Bridge";
public const Int16 MQTT_BRIDGE_PORT_SSL_INT = 8883;
public const String MQTT_BRIDGE_USER = "ABC";
public const String MQTT_BRIDGE_PASSWORD = "123";

static MqttSslProtocols SSLProtocol = MqttSslProtocols.TLSv1_0;

//Setup MQTT credentials and create client
string clientId = MQTT_BRIDGE_USER + Guid.NewGuid().ToString();

MQTTClient = new MqttClient(tbIPAddress.Text, MQTT_BRIDGE_PORT_SSL_INT, true, new X509Certificate(Properties.Resources.ews_ca), null, SSLProtocol);

MQTTClient.MqttMsgPublishReceived += MQTTClient_MqttMsgPublishReceived;


MQTTClient.Connect(clientId, MQTT_BRIDGE_USER, MQTT_BRIDGE_PASSWORD);

//Subscribe to all messages
string[] topic = { "#" };
byte[] qosLevels = { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE };
MQTTClient.Subscribe(topic, qosLevels);



The exception I see is: {"The remote certificate is invalid according to the validation procedure."}

It would be much appreciated if somebody could help me out here.

Cheers,

Marcel

[Updated on: Mon, 15 January 2018 21:45]

Report message to a moderator

Previous Topic:Java Paho: ClientId longer than 23 characters
Next Topic:paho mqtt raspberry and esp8266
Goto Forum:
  


Current Time: Fri May 03 14:06:33 GMT 2024

Powered by FUDForum. Page generated in 0.03255 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top