Giter Site home page Giter Site logo

technobly / httpsclient-particle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glowfishapi/httpsclient-particle

0.0 3.0 0.0 4.5 MB

An httpsclient implementation for particle.io's photon

License: GNU General Public License v2.0

C 98.55% C++ 1.43% Shell 0.02%

httpsclient-particle's Introduction

Overview

Designing this with IOT in mind. Most webservers willing to collect data from devices prefer talking https. Securing communication to-and-from smaller footprint devices (like particle.io Photon etc.) and standard web servers doing interesting stuff with this data (glowfi.sh, thingspeak.com, etc) is the goal. There is a hard limitation you hit with https and that dictates that you have about 50kB of meemory allocated for it. This is because of huge Certificate chains that get shipped from https servers.

In all this, lack of a readily available plug and play httpsclient brings us here. Integrating MatrixSSL with a standard TCP client seemed like a good starting point.

Any feedback (especially critical) and contributions are welcome!

Building it with spark firmware

Assuming you are comfortable using this library: https://github.com/spark/firmware

  • Clone the httpsclient-particle
  • Copy the contents of the firmware directory into the above firmware/user/src/ directory of the spark firmware library.
  • Pick one of the files in the examples directory. And copy it into user/src directory.
  • Goto firmware/main/ of the spark firmware directory again. And build it (Again, instructions for this are at https://github.com/spark/firmware)

Current State

What's here is a semi-stable working httpsclient that can make requests from the particle photon board to webservers running https. The client implementation is simple, and as of now can handle 1 connection at any given time. Other features (for now) are:

Adhere to security

  • TLS 1.2
  • RSA 2048bit key length
  • Slow is OK, but secure is a must!
  • Ramping this up to 4096bit key length ought to be tested, and this may just consume a whole lot of memory (AGAIN, especially the server certificates). Writing the certificate chains to flash is an option.

Small memory footprint:

  • Client only
  • Single session
  • No Client Authentication
  • Static memory allocation

License:

GPL, as matrixSSL-open library is under GPL.

A few important changes from MatrixSSL:

  • Make the ssl structure static, as we are just using a single session.
  • Header file compatibility with particle.io build system. This means adjusting the include paths (this needs to be fixed).
  • Keep SSL in-out buffers static.

TODO:

  • Add and test Elliptic curve support (This will take up a larger footprint)
  • Find a better way to seed entropy. Currently takes the last 8 bits of the system microsecond counter.
  • Add a feature to generate header files from RSA keys, etc. After this remove samplecerts from the repository (?)
  • Inspect all dynamic memory allocations and check for memory leaks (all psMallocs)
  • Add tests!! MatrixSSL tests are heavy handed. Need to carefully go through these and add the ones needed.
  • Find a better way to include header files
  • A memory pool implementation (if needed), especially to give back the obscene amount of memory SSL Certificates consume.
  • The only way to currently print and trace info on the particle.io's photon is by using Serial (written in c++). This is a bit painful if the rest of your library is in C, necessary '.h' file needs to be wrapped with extern C wrappers to get it to build correctly.
  • Last but no way the least, a thorough security AUDIT.
  • Decide on keeping this repository in sync with MatrixSSL-open. This isn't trivial as keeping up with Photon/Arduino/MatrixSSL build systems maybe be a handful.

httpsclient-particle's People

Contributors

jersey99 avatar josecodes avatar technobly avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.