Downloading large data over SSL secure (https) client

Problem description

The task is simple: I need to download a file to an SD card connected to my particle B402, this is simple and achievable with the TCP Client object, providing an easy solution with the use of a Stream object, however, the TCP client is not secure.

I need a file downloading solution for a b402 gen 3 that meets all of the following criteria:

  • Secure(https) connection
  • Relatively fast download times(we are talking very relative, I would like to be able to achieve speeds of ~10kB/second but speed is something that I am willing to sacrifice
  • Uses a Stream object for ease of downloading to the SD card, but mostly for the reliability of the Stream class

Solutions that I have already tried/am not satisfied with

I have tried a few things, I have had success downloading files with both of these methods, however method 1 is not secure, and method 2 is very cumbersome, and very slow.

  1. Using the TCPClient class
  2. Encoding data over base64 and using a particle command to send the data as a string, decode it, and then save it as bytes

Conclusion

So recapping, the requirements for my problem are:

  • Secure (https) connection
  • Use of the Stream class for transfer of data
  • Reasonable speed, as long as it’s not a crawl
  • Able to be used in closed source project

I am currently using method 2 as outlined in Solutions that I have already tried/am not satisfied with with a fair degree of success, but I will soon have to refactor this code a great deal, and if I must refactor again it would be much simpler to operate with a Stream object.

It would be cool to see a particle firmware class that is Particle.SecureTCP that can take an SSL certificate as a parameter, or use the existing SSl infrastructure that already exists within the particle cloud system, forgive me if this is obviously impossible, I have brushed over the firmware on github but never in depth with the connections

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.