Public-key / asymmetric cryptography on ESP32/ESP8266 - cryptography

I am currently trying to secure the transmission of IoT devices for my ESP32 and ESP8266 based projects. As there are functions for ESP-TLS and RSA available and also HTTPS support, there should be something like this available. Unfortunately I could not find anything in ESP-IDF an also no usage/code examples. Has anyone been working with this? Are there examples available?
PS: I am not looking for an Arduino library and I have already checked the AES ECB/CBC buy I am explicitly looking for a pub/sub functionality using the internal function of the ESP-IDF.

Related

How to ensure that transactions with mobile sensor data are authentic in a decentralized app

I'm working on an idea of a DApp that measures some information from Clients mobile phones and send it to validators on a consortium blockchain network.Actually i can't figure out how to secure the transaction, and more specifically prove that the data was measured with the sensors of the mobile where the application is installed, or just from the application.
I'm a beginner blockchain developper with some experience in Hyperledger Sawtooth and cryptography based algorithms. When i searched for the problem, i saw that there are some possibilities like running code in a Trusted Execution environment ( Intel SGX for example ) or embed a private key in the code to - in addition of client transaction signing - prove that the measures were realized with my app ( And not someone faking the data and sending it with curl or something ). But those solutions are not exactly convenient in my case.

SSL/TLS support in Kaa with ESP8266

I am new to Kaa and is trying to implement a Kaa based solution with ESP8266. I want to know if it supports SSL/TLS sockets for communication. If not, is there any way to make communication secure (like starttls).
I am currently programming ESP 12E (A variant of ESP8266) using Arduino IDE. Is there any way for me to send data directly to a Kaa installation through secure communication?
Thanks is advance!
Starting from Kaa 0.10, the C SDK uses a hybrid RSA+AES encrypted connection by default.
See KAA-635 for more details.

SIP-WebRTC gateway/bridge: Kurento OR openwebrtc OR Intel CS for webrtc

I am researching implementation of a WebRTC-SIP gateway/bridge. That is, for example, to make a WebRTC call to a SIP end point via a SIP server like Asterisk. I know that Asterisk already supports this but I need an intermediary server for various needs like logging, recording, integration with local auth/signalling and other app modules. I looked at Kurento, Openwebrtc (Ericson) and the lesser known Intel's Collaboration Suite for WebRTC.
I need a server-side solution to interact with my Node Application server. Specifically, the server-API should be able to generate a SDP for a RTP end point and convert WebRTC SDP to the more generic SDP used by Legacy SIP servers or have a way to bridge these two end-points. I feel comfortable that this is possible with Kurento (saw a post on except that I am not aware of any jsSip/sipML5 kind of API for Kurento. Kurento itself is not meant to provide signalling. For e.g., if the SDP generated by Kurento for the rtpEndpoint in Kurento has to be used in a SIP call/INVITE, how would one implement it? For that matter, how would one initiate a SIP INVITE, for example, from Kurento? Are there third-party modules to do this?
Has anyone used the any of the servers listed above for a similar use case?
This is a programming question. I am looking for server APIs to implement a WebRTC to SIP gateway/bridge for media transcoding (if required), SDP transformation and SIP signalling.

Integrating Asterisk with WebRTC - ground up

I am trying to integrate Asterisk with webRTC. There was a query posted here but it barely provides any solution.
I already have a basic webRTC infrastructure in place which I have tested for proof-of-concept. I use socket.io for signalling, COTURN for STUN/TURN with node.js and supporting modules for my web server.
I use MySQL for session persistence.
My asterisk installation works fine with SIP phones and a PRI card for my PSTN interface. My Asterisk, webserver and other supporting servers run on the same box.
There are instructions on Asterisk here and on sipjs here (and other similar products site) to integrate Asterisk with WebRTC.
From my reading there, it appears that Asterisk has a builtin webserver for wss support, uses pjproject for ICE, TURN/STUN servers, among other things.
I see that taking the approach here would mean duplicating the infrastructure.
I would like to implement an audio gateway from WebRTC to a SIP or DAHDI channel. This is essentially an audio call to a PSTN number or a SIP end-point from the browser.
The way I see it is that with what I have in place, I will need the following:
A codec transcoder for audio (Browser codec to Asterisk codec),
possibly Kurento.
Some way to convert a WebRTC SDP to an Asterisk
SDP.
Some way to "register" a logical webRTC peer to the SIP
proxy(Asterisk).
Some intermediate module for Asterisk to think of a
WebRTC peer as a SIP end point.
Anything else?
I think this must have been implemented before. I am unable to find any solution or discussion in this direction.
Am I on the wrong track?
Am I reinventing the wheel?
Any guidance will be most appreciated.
There is nothing to be "implemented" here. All the listed points are already implemented in Asterisk.
The links you mentioned discusses mostly old versions of Asterisk. I recommend to use a recent guide for WebRTC on Asterisk 13.
A codec transcoder for audio (Browser codec to Asterisk codec),
possibly Kurento.
Transcoding is built-in Asterisk by default. However WebRTC has support also for G.711 (PCMU and PCMA) so most probably you never have to transcode.
Some way to convert a WebRTC SDP to an Asterisk SDP.
This is already handled by Asterisk and all the popular WebRTC SIP clients (sip.js, webphone, sipml5) using RFC 7118 (WebSocket for SIP protocol). Instead of using socket.io with your custom protocol, I would highly recommend to use this. (Socket.io is using websocket anyway in all modern browsers and when webrtc is not available webrtc will be missing too)
Some way to "register" a logical webRTC peer to the SIP
proxy(Asterisk).
This is like the usual SIP REGISTER on websocket mentioned above
Some intermediate module for Asterisk to think of a WebRTC peer as a
SIP end point.
Nothing extra is needed for this. Follow the guide which I have mentioned above to setup a WebRTC externsion (it is like other SIP extension and WebRTC can talk with SIP once configured).
Note that most probably you don't even need TURN and STUN for this if your Asterisk has a public static IP. (Except some basic STUN which is part of the ICE protocol and already built in Asterisk)

How to implement websockets on an embedded device server?

I am working with an electronics appliance manufacturer to embed LAN based control systems into the products. The idea is to serve up a system configuration/control interface through a web browser so clients never need to install software. We can communicate with the appliance by sending and receiving serial data through the embedded module. Since the appliance can also be controlled from a front panel UI, it creates a challenge to keep a remote web interface in sync with very low latency. It seems like websockets or some sort of Push is what we need for handling real time events from the server to clients.
I am using a Lantronix Mathport AR embedded device server. Out of the box the unit will serve up any custom HTML and java servlets/applets. We have the option to install a lightweight Linux distro if we need more flexibility. I am not sure how to implement any server side apps since the device is not running standard Apache. I believe it is using Boa.
Can anyone guide me in the right direction of how to do this?
Some general info...The WebSocket protocol (draft spec here) is a simple layer on top of TCP. What this means is that, if you already have a TCP server for your platform, implementing the WebSocket is just a matter of hours. The protocol specifies a handshake and two ways of sending data frames.
I strongly suggest you start by reading the 39 pages spec.
As Tihauan already mentioned, start by reading the spec, and also note that there are still some changes ongoing, although websockets is now more stable than it was 1 year ago.
Key point for me was the requirement that websocket data is entirely UTF-8 text, which lends itself nicely to JSON based message definitions.
Our system uses a form of embedded linux, so we then added and made use of the following libraries:
"libwebsockets" from:
http://git.warmcat.com/cgi-bin/cgit/libwebsockets/
"jansson" from:
http://www.digip.org/jansson/
Using the above as support libraries, we created an internal lightweight "client/server" that allowed our other software modules to register for certain, applicable, websocket messages, and respond as needed. Worked great.
Good luck and best regards,
I'm a bit late, but Mozilla posted a guide entitled "Writing WebSocket servers", which literally guides you through writing a websocket server.
You will need to already know how HTTP works and have medium programming experience. Depending on language support, knowledge of TCP sockets may be required. The scope of this guide is to present the minimum knowledge you need to write a WebSocket server.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers