0

Im working on WinCE 2013 and want to use mqtt protocol with SSL/TLS. But it seems like that the SSL StreamCLass is not supported in .Net CF3.9. Could anyone please let me know if there is anyway the SSL/TLS can be enabled in .NCF3.9 for communication. I want to use the SSL Stream class and the

using System.Net.Security;
using System.Security.Authentication;

but couldnt do so...

3 Answers 3

0

In order to enable SSL/TLS on M2Mqtt you need to define SSL symbol. For example, if you see the Net MF 4.3 project file (https://github.com/eclipse/paho.mqtt.m2mqtt/blob/master/M2Mqtt/M2Mqtt.NetMf43.csproj) there is this section :

<DefineConstants>DEBUG;TRACE,MF_FRAMEWORK_VERSION_V4_3,SSL</DefineConstants>

As you can see there is the SSL symbol. It enables the build with SSL support.

3
  • Thank You Sir for your reply, but i want to do it on .NETCF 3.9/3.5. And i did what you have mentioned but while compiling it gives me error saying that the :using System.Net.Security; using System.Security.Authentication; are resulting into error saying that missing reference assembly for above mentioned namespace. Also do I have to edit it in the dll file or after the dll is referenced in the application. And is there a sequence to be followed for editing the Define constants.
    – K.Sohan
    Sep 6, 2017 at 7:08
  • You are right, I have just checked. The library doesn't support the SSL/TLS with .Net CF 3.5/3.9. I added this support for the AMQP .Net Lite library (github.com/Azure/amqpnetlite/tree/master/src/NetCF39) but not in the M2Mqtt.
    – ppatierno
    Sep 6, 2017 at 7:17
  • Sir, there is one way possible to do it on .NETCF3.5 using m2mqtt. On GitHub this issue was raised and one engineer did it by using the Paho C library. He built the native dll and imported it in .NETCF3.5 with openssl dll. But i dont know how to go ahead with this. So if you could help me with this please let me know..
    – K.Sohan
    Sep 6, 2017 at 7:34
0

Have a look at: https://m2mqtt.wordpress.com/ It's an MQTT implementation ready to use and, if it doesn't fit your needs, you can, at least, look at how SSL is implemented in .NET CF.

5
  • I have been using the same libraries but have been getting errors regarding the SSL/TLS enable. When I searched more about it, i have realised that mqtt protocol implementation using this library is possible but not over SSL.But there is a way to do it by using the Paho C library dll and Openssl dll and importing both in .netCF and then building solution. Still havent been able to do so..If you can suggest on how to go ahead please let me know. Thank You.
    – K.Sohan
    Sep 4, 2017 at 11:22
  • What errors do you get? I remember having tested this on CF 3.5. Sep 5, 2017 at 12:32
  • Errors regarding M2MQTT libraries i get: "Library Compiled Without SSL support" This is when i try to connect to azure using CF3.5/CF3.9 which requires SSL/TLS support. But when I try it without SSL on 1883 port to test over a broker server i get connected. So indeed its neccessary for me to enable SSL but I dont know how..And if you are talking about the second method then I havent made any progress in it. I dont know how to.If you have done using either of the methods please let me know..
    – K.Sohan
    Sep 6, 2017 at 4:10
  • I think that Paolo's comment (author of the lib) solved the issue :) Sep 6, 2017 at 7:03
  • sorry, I mixed up AMQP and MQTT. But, as Paolo suggested, you can check the SLL implementation on AMQP and use the same technique on MQTT. As soon as you have validated the SLL certificate, the rest of the connection will behave in the same way over a regular socket and over an SSL one, like in AMQP. Sep 7, 2017 at 5:47
0

I added OPENSSL suppport for Compact Framework 2.0 / 3.5 / 3.9 in M2MQTT library. Check https://github.com/bpastore/paho.mqtt.m2mqtt/tree/dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.