Is it possible to use boost::asio with DTLS? - boost-asio

I think the title says most of it, but I am also interested in understanding what it takes to get DTLS support into asio if there is no existing solution

ASIO itself does not support DTLS but there is a GitHub library asio_dtls which has added support (work-in-progress) into ASIO.
It was submitted to be added into ASIO but the author of ASIO hasn't been accepting new features into ASIO for awhile, most likely because of his efforts to submit ASIO into the C++ standard is taking up all of his spare time.

Related

Public-key / asymmetric cryptography on ESP32/ESP8266

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.

Can boringssl work in bare metal ARM system?

Can boringssl work on ARMv8 bare metal platform? I tried build boringssl with aarch64-elf-gcc, but it refused to build.
If it does, any porting guide or suggestions?
Probably not out of the box. But you should probably not even try using it, mainly because, according to Google itself, it is not intended for general use.
This is never good to be on your own when using a library, more specifically a cryptographic one. This is usually synonym for no bug fixes, no support, no user forums among other things.
You could rather consider a library that was designed for this purpose, such as mbedtls (formerly known as PolarSSL).
It is being used on a wide range of systems, from bare-metal systems (FreeRTOS) to Linux (The Hiawhata web server does use it for example).
Update: Even if support for Armv8-a hardware crypto extensions is needed, you could still reuse BoringSSL Armv8-a optimized routines (ISC license) or the Cavium armv8_crypto library (BSD license), to replace mbedtls (Apache 2.0 lisense) equivalent routines: cryptographic functions usually have clean and small interfaces.
From my experience, this may still be faster than porting a library targeting a general purpose operating system if your target is a bare-metal one, but you ultimately have to evaluate the costs for both options in your specific case.
My guess would be that there is far less work involved for adding support for Armv8-a crypto extensions to mbedtls using already existing, supported code under the proper license, than attempting to strip-down openssl or boringssl for use on a bare-metal target.
There is a very good piece of documentation explaining how to add support for hardware-accelerated crypto to mbedtls here, this may help you evaluating your options.

RabbitMQ client in Elm

I'm a newbie in Elm-lang and am writing a program that requires the backend to consume messages from rabbit. I was mainly programming using Elixir before and all the other languages I used had open source rabbit clients. I wonder if there is one for Elm since I couldn't find any on github.
If there isn't one, what's the recommendation for solving this problem? Shall I switch to use web-socket or use frontend to get messages? I was also looking into using haskell servant like this but it seems to make things complicated: https://github.com/haskell-servant/example-servant-elm
This project has probably long since been finished but RabbitMQ can also use the mqtt protocol which is much more widely used by frontend languages and frameworks. Maybe something like this would work:
https://github.com/Jwsonic/elm-mqtt

zeromq on embedded cortexM3 platform

Does anyone have already implemented zeroMQ as reliable message solution on cortexM3 nodes? I'm trying to understand if it is possible and to have a memory footprint idea of this. I will have freeRTOS OS maybe.
Thanks for ideas and suggestions.
Nicola
See this thread on the zeromq-dev list. It seems the 0MQ source makes extensive use of POSIX API, so would take some porting to be supported on a non POSIX OS. Moreover it requires a TCP/IP stack which may have a larger footprint that 0MQ itself.
For a port FreeRTOS may not be a good starting point - you'd either have to implement a porting layer to map the POSIX API calls to your RTOS and network stack, or modify the 0MQ source directly (which would make accepting updates problematic).
There are a number of RTOS with POSIX or POSIX-like APIs. Amongst free/open-source RTOS NuttX may be a better bet. It has a POSIX like API and a BSD sockets API stack.

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