Example Code

TCP/IP Communication over SSL

Code and Documents

Attachment

Overview

Code for TCP/IP over SSL

Description

LabVIEW doesn't provide any support for SSL based TCP/IP communication unlike HTTP. Hence, for one of my project, I have developed a small library that fulfills the role of a TCP SSL server.

It works fine for me but I am still improving on it for implementing the asynchronous methods.

If anyone has any idea, feel free to suggest.


Steps to Implement or Execute Code

  1. An example VI of SSL server is created.
  2. Provide a valid certificate path and path to that certificate in the controls.
  3. Specify the port number and run the application.
  4. I have also added one sample certificate. Please change the certificate path in the control. Thats it.

Requirements

Software-LabVIEW.

Hardware-Tested on Win7-32 bit OS.

Additional Images or Video



Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
zerotolerance
Active Participant
Active Participant
on

This seems to only support the server side (as stated). How difficult would it be for a client side.

Thanks

Kas

RJ_15
Member
Member
on

Hi Kas,

I am working on it. Will update soon.

Regards,

Runjhun.

ncolson
Member
Member
on

Thanks for posting your code!  I also need an SSL client, so I'm working from your server code as an example.  If you have a client in the works, I'd be interested in seeing it.

Thanks,

Nathaniel

HHH123
Member
Member
on

I am running SSL server from example folder, but it throws following error message. error.png

How to resolve this certificate issue?

Padhams
Member
Member
on

I need an SSL Cleint ,If you have it ,please update

RJ_15
Member
Member
on

I have been getting many requests for posting the SSL client code.

The implementation of the SSL client is bit tricky in LabVIEW. When I was designing it to work for my server code, LabVIEW was hanging more than often. Also I needed asynchronous communication and which cannot be supported by only LabVIEW .net calls.

 

So I ended up writing a C# code that implemented the SSL client functionality. I used that DLL and registered the connect/authenticate/read/write events using event callbacks functionality in LabVIEW.

Unfortunately the DLL code is proprietary so I cannot share that. Though if anyone is interested I can let you know the high level .net functions I have used to implement that. But definitely you need an additional programmer to write that code for you.

txs40
Member
Member
on

Hi,

I'm trying to create an server application using the library that you shared. Unfortunately I'm not able to pass the SSL server authentication irrespective of trying with various server certificate files and SSL protocol types. I repeatedly get the below error. I hope you would have faced the similar issue during implementation phase and help me out in this.

 

Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception: System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception.

Inner Exception: System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm

 

 

 

Possible reason(s):

 

LabVIEW:  A .NET exception occurred in an external assembly. For information about correcting this error, copy the following exception (in bold), and search the Microsoft Developer Network (MSDN) Web site or the Web for a possible explanation.

System.ComponentModel.Win32Exception in SSL Lib.lvlib:Authenticate SSL Server.vi:2210001->Sever SSL.vi

Ettepet
Member
Member
on

The TLS/SSL functionality in Labview now appears to be in Beta: (Labview 2020?)

 

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/SSL-TLS-Support/idi-p/3314187

Contributors