MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

Client-How to communicate with the server using tls-psk encryption mode?

Open FANG-Zhiguo opened this issue 6 years ago • 7 comments

Describe your question

I have a project that needs to communicate with an existing MQTT server.

The MQTT server uses tls-psk encryption.

I set the. WithTls () method directly and throw an exception "Win32Exception: Because of the different algorithms, the client and server can not communicate" when calling the. ConnectAsync () method.

I hope experts can help me. Thank you very much.

Which project is your bug related to?

  • Client

FANG-Zhiguo avatar Aug 05 '19 09:08 FANG-Zhiguo

Which version of MQTTnet are you using and which platform is the client running on (UWP, .NetCore, .NetFramwork, Xamarin, ...)?

SeppPenner avatar Aug 05 '19 09:08 SeppPenner

Which version of MQTTnet are you using and which platform is the client running on (UWP, .NetCore, .NetFramwork, Xamarin, ...)?

MQTTnet version: 3.0.5 .NetCore version: 3.0

FANG-Zhiguo avatar Aug 05 '19 10:08 FANG-Zhiguo

.NetCore version: 3.0 Preview 7?

I'm not yet sure whether this is supported yet. @chkr1011 Do you have details here?

SeppPenner avatar Aug 05 '19 10:08 SeppPenner

.NetCore version: 3.0 Preview 7?

I'm not yet sure whether this is supported yet. @chkr1011 Do you have details here?

.NetCore version: 3.0-Preview 7

But what I want to consult is how to set the client encryption mode to tls-psk.

The server partner gave me information for connection validation: Host: tcp://172.18.xxx.xxx:8xxxx User name: Java Publishxxxxx Password: XXXXXXXX Pskid: hFxasjBiMWaSaxxxxxx PskString: pupkNACiqzk2kTwxxxxx

I don't know how to set the parameters "pskid" and "pskString" in MqttClient.

FANG-Zhiguo avatar Aug 05 '19 10:08 FANG-Zhiguo

I don't know how to set the parameters "pskid" and "pskString" in MqttClient.

Yes, I did understand that. I don't know if this is even supported yet. This is something, @chkr1011 (I'm not into the code that deep yet) needs to answer. He is the owner and also main developer here ;)

SeppPenner avatar Aug 05 '19 12:08 SeppPenner

I don't know how to set the parameters "pskid" and "pskString" in MqttClient.

Yes, I did understand that. I don't know if this is even supported yet. This is something, @chkr1011 (I'm not into the code that deep yet) needs to answer. He is the owner and also main developer here ;)

Well, thank you for your answer.

FANG-Zhiguo avatar Aug 06 '19 02:08 FANG-Zhiguo

Based on the content of MqttClientTlsOptions.cs I assume that TLS-PSK encryption is not supported by MQTTnet.

schlotter avatar Jun 25 '21 16:06 schlotter

This library makes use of the TLS stream from .net. So if a particular feature is not available in these implementations we also do not support it. This library exposes all APIs from the TLS stream which are available. If there is something missing I assume we cannot do much to solve this issue.

chkr1011 avatar Aug 23 '22 19:08 chkr1011