This thesis has been developed using GoLang.
The framework is in the main-app
folder, to manage the main server and its interaction.
Once started, it will create its own database file using sqlite, with the name FSHK.db
, wherever the program is started.
You can choose two ways of starting protocols services :
- Either enable the protocols using the JSON file called "protocols.json" next to the app (it must follow the template as given in
/main-app/protocols.json
). This way, themain-app
will start its own services. - Or you can start your own services, on the device you want, using the different services provided in
test/received-*.go
. Be sure to forward data to the right IP/port if you move it.
Each message must respect the same architecture, except for specified protocols. It must have at least 24 bytes for the message header, and a maximum of 65 536 bytes at most. So, body can contain up to 65 512 bytes.
Repartitions of the header :
- 0-1 : Data Length
- 2-14 : Aes IV
- 15 : Data Type
- 16-24: Padding (reservation for possible upgrade)
Of course the data length must match the data, otherwise the message won't be processed.
The system uses two distincts encryptions.
The first one, and the most used is AES-128. It is used for most of the communications of the kit, since most of it transits through big packets such as the ones in WebSockets (maxed at 65536 here). A new IV is generated every time for every message, while the MasterKey is hard-coded for every device. Since the encrypted data is not necessarily the same size of its original data, the first bytes must be edited to fit.
The second system is the algorithm PRESENT1, which is an ultra lightweight algorithm, created to be run on low computational units. In some of our cases, such as BLE communications, remote devices have not the memory not the power to compute AES-128 fast enough. In those cases, as the data have very strict limitations, it is an ideal pick.
WebSocket
Main-App is managing WebSockets from scratch on port 5001. It's on this websocket that every protocol is forwarded.
UDP
This software allows UDP packets to be received on the port 5010 Then, it forwards it to the main app, to register everything.
If something is received, the service will acknowledge it using a return message {"data":"OK"} everytime. If you do not receive it, your message has not been received.
TCP
This software allows TCP packets to be received on the port 5020 Then, it forwards it to the main app, to register everything.
If something is received, the service will acknowledge it using a return message {"data":"OK"} everytime. If you do not receive it, your message has not been received.
Bluetooth Low Energy
BLE is managed internally using a WebSocket listening on Port 5030. Every device must have its own adapter to connect through it. An example of such a device can be observed in test/wristband-ble.go.
A web interface is available once the program is started, on the port 5002. It will interact with the server using a specific websocket designed to this effect.
Copyright 2020 Kévin Chapron.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1 Bogdanov A. et al. (2007) PRESENT: An Ultra-Lightweight Block Cipher. In: Paillier P., Verbauwhede I. (eds) Cryptographic Hardware and Embedded Systems - CHES 2007. CHES 2007. Lecture Notes in Computer Science, vol 4727. Springer, Berlin, Heidelberg.