# EnigmaIoT
<img src="https://github.com/gmag11/EnigmaIOT/raw/master/logo/logo%20text%20under.svg?sanitize=true" alt="EnigmaIoT Logo" width="50%"/>
[![ESP8266](https://github.com/gmag11/EnigmaIOT/workflows/ESP8266/badge.svg)](https://github.com/gmag11/EnigmaIOT/actions?query=workflow%3AESP8266)
[![ESP32](https://github.com/gmag11/EnigmaIOT/workflows/ESP32/badge.svg)](https://github.com/gmag11/EnigmaIOT/actions?query=workflow%3AESP32)
## Introduction
**EnigmaIoT** is an open source solution for wireless multi sensor systems. It has two main components, multiple **nodes** and one **gateway**.
A number of nodes with one or more sensors each one communicate in a **secure** way to a central gateway in a star network using EnigmaIoT protocol.
This protocol has been designed with security on mind. All node data is encrypted with a random key that changes periodically. Key is unique for each node and dynamically negotiated, so user do not have to enter any key. Indeed, all encryption and key agreement is transparent to user.
I designed this because I was searching for a way to have a relatively high number of nodes at home. I thought about using WiFi but it would overload my home router. So I looked for an alternative. I evaluated LoRa or cheap nRF24 modules but I wanted the simplest solution in terms of hardware.
ESP8266 and ESP32 microcontrollers implement a protocol known as ESP-NOW. It is a point to point protocol, based on vendor specific [WiFi management action frames](https://mrncciew.com/2014/09/29/cwap-802-11-mgmt-frame-types/), that works in a connectionless fashion and every packet is a few milliseconds long. Because of this, it eases to have a battery powered node so that it enables designing totally wireless sensors.
But use of encryption on ESP-NOW limits the number of nodes to only 6 nodes. So I thought that I could implement encryption on payload but I found many problems I should solve to grade this as "secure enough".
Find library documentation on https://gmag11.github.io/EnigmaIOT
## Quick start
It you are courious to quickly test how does EnigmaIOT performs you can follow this [howto guide](docs/howto.md). This will guide you on how to:
- Setup your gateway
- Build simplest EnigmaIOT node
- Configure your first node
- Develop custom nodes with advanced features
## Project requirements
During this project conception I decided that it should fulfil this list of requirements.
- Use the simplest hardware, based on ESP8266 and/or ESP32.
- Secure by design. Make use of a secure channel for data transmission.
- Automatic dynamic key agreement.
- Do not require connection to the Internet.
- Do not overload my home WiFi infrastructure. Only Gateway will be connected to LAN.
- Able to use deep sleep to run on batteries.
- Enough wireless range for a house.
- Support for a high number of nodes.
## Features
- [x] Encrypted communication using [**ChaCha20/Poly1305**](https://tools.ietf.org/html/rfc7539)
- [x] Dynamic key, shared between one node and gateway. Keys are independent for each node
- [x] Shared keys are expired after a certain (configurable) time.
- [x] Number of nodes is only limited by memory on gateway (60 bytes per node)
- [x] Key is never on air so it is cannot be captured
- [x] Key expiration and renewal is managed transparently
- [x] Avoid repeatability attack having a new random initialization vector on every message. This is mandatory for ChaCha20/Poly1305 in order to keep cipher secure
- [x] Automatic and transparent node attachment
- [x] Avoid rogue node, rogue gateway and man-in-the-middle attack
Notice that network key used to implement this feature is stored on flash. ESP8266 do not allow flash encryption so network key may be recovered reading flash.
- [x] Pluggable physical layer communication. Right now only ESP-NOW protocol is developed but you can easily add more communication alternatives
- [x] When using ESP-NOW only ESP8266 or ESP32 is needed. No more electronics apart from sensor
- [x] Data message counter to detect lost or repeated messages
- [x] Designed as two libraries (one for gateway, one for node) for easier use
- [x] Crypto algorithm could be changed with low effort
- [x] Node and Gateway do store shared keys only on RAM. They are lost on power cycle. This protects system against flash reading attack. All nodes attach automatically with a new shared key after gateway is switched on
- [x] Downlink available. If deep sleep is used on sensor nodes, it is queued and sent just after node send a data message
- [x] Optional sleep mode management. In this case key and context has to be stored temporally. Normally RTC memory is the recommended place, and it is the one currently implemented.
**Note**: There is the alternative to store context on flash memory so that node can be completely switched off between massages without requiring a new registering. Notice that on every received or sent message node updates this context so consider that a high number of writes in flash may degrade it in the medium term. If messages counters are disabled in configuration the number of writes is decreased drastically but this reduces security level as it makes possible to repeat messages.
- [x] Initial configuration over WiFi portal on each device
- [x] Node configuration while in service using control downlink commands
- [ ] OTA over WiFi. Question: Is it really useful? Place an issue explaining an use case.
- [x] OTA over MQTT/ESP-NOW. Check [OTA script guide](docs/node-ota-update.md).
- [x] Node identification by using a flashing LED. This is useful when you have a bunch of nodes together :D
- [x] Broadcast messages that go to all nodes. This is implemented by sending messages to broadcast address (ff:ff:ff:ff:ff:ff in esp-now). Only nodes that are always listening are able to receive these messages, they are not queued. In order to send a broadcast message using EnigmaIOTGatewayMQTT you may use `<network name>/broadcast/...` as topi beginning. Any control or data message will arrive all nodes that have broadcast enabled. Control messages are processed normally except OTA and SET NAME, which are ignored. Data messages are passed to user code for processing.
A shared encryption key is used to encrypt broadcast messages. It is generated automatically by Gateway on every restart.
If a node registers with broadcast flag active, gateway sends broadcast key using this message just after successful registration. Broadcast key is automatically generated on gateway on boot, so it will be different after every restart. Nodes will be synchronized as soon they register again.
A node may not send broadcast messages, only gateway can.
- [x] Both gateway or nodes may run on ESP32 or ESP8266
- [x] Simple REST API to get information and send commands to gateway and nodes. Check [api.md](docs/api.md)
- [x] Node library includes methods to configure [Home Assistant](https://www.home-assistant.io) automatic integration using [MQTT discovery](https://www.home-assistant.io/docs/mqtt/discovery/)
## Technical background
If you want to know the internals about EnigmaIOT check [Technical Background Guide](docs/technical-background.md).
没有合适的资源?快使用搜索试试~ 我知道了~
基于 ESP8266 和 ESP32 的 安全传感器和网关平台_C++_代码_相关文件_下载
共926个文件
html:521个
js:158个
png:91个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 61 浏览量
2022-07-14
01:52:01
上传
评论
收藏 5.63MB ZIP 举报
温馨提示
介绍 EnigmaIoT是用于无线多传感器系统的开源解决方案。它有两个主要组件,多个节点和一个网关。 具有一个或多个传感器的多个节点使用 EnigmaIoT 协议以安全方式与星形网络中的中央网关通信。 该协议的设计考虑了安全性。所有节点数据都使用定期更改的随机密钥进行加密。每个节点的密钥都是唯一的,并且是动态协商的,因此用户不必输入任何密钥。事实上,所有加密和密钥协议对用户都是透明的。 我之所以设计这个是因为我正在寻找一种在家中拥有相对大量节点的方法。我考虑过使用 WiFi,但它会使我的家用路由器超载。所以我寻找了一个替代方案。我评估了 LoRa 或便宜的 nRF24 模块,但我想要最简单的硬件解决方案。 ESP8266 和 ESP32 微控制器实现了一种称为 ESP-NOW 的协议。它是一种基于供应商特定WiFi 管理操作帧的点对点协议,以无连接方式工作,每个数据包只有几毫秒长。正因为如此,拥有一个电池供电的节点很容易,这样它就可以设计完全无线的传感器。 更多详情、使用方法,请下载后细读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
基于 ESP8266 和 ESP32 的 安全传感器和网关平台_C++_代码_相关文件_下载
(926个子文件)
EnigmaIOT.bmp 253KB
EnigmaIOT64x48_8bits.bmp 3KB
EnigmaIOT64x48.bmp 442B
EnigmaIOTNode.cpp 84KB
EnigmaIOTGateway.cpp 67KB
GwOutput_mqtt.cpp 22KB
SmartSwitchController.cpp 19KB
GatewayAPI.cpp 14KB
espnow_hal.cpp 8KB
NodeList.cpp 8KB
haCover.cpp 7KB
LedController.cpp 6KB
haBinarySensor.cpp 6KB
Filter.cpp 5KB
helperFunctions.cpp 5KB
ds18b20Controller.cpp 5KB
haSensor.cpp 5KB
cryptModule.cpp 4KB
ButtonController.cpp 4KB
haSwitch.cpp 4KB
DashButtonController.cpp 4KB
BasicController.cpp 4KB
haTrigger.cpp 3KB
GwOutput_dummy.cpp 2KB
timeManager.cpp 2KB
doxygen.css 30KB
tabs.css 9KB
search.css 4KB
EnigmaIOTGateway Data Flow.dia 9KB
StateDiagram.dia 5KB
NodeRegistrationCollision.dia 3KB
WrongCounter.dia 2KB
NodeRegistration.dia 2KB
NodeNotRegistered.dia 2KB
RegistrationIncomplete.dia 2KB
KeyExpiration.dia 2KB
Doxyfile 113KB
Node.fzz 19KB
Gateway.fzz 4KB
.gitignore 256B
.gitignore 13B
.gitignore 13B
.gitignore 13B
.gitignore 13B
.gitignore 13B
.gitignore 12B
.gitignore 12B
.gitignore 12B
.gitignore 12B
.gitignore 12B
.gitignore 12B
.gitignore 12B
EnigmaIOTNode.h 33KB
EnigmaIOTGateway.h 23KB
NodeList.h 19KB
haEntity.h 12KB
haCover.h 10KB
haSwitch.h 9KB
haBinarySensor.h 8KB
GwOutput_mqtt.h 8KB
haTrigger.h 7KB
EnigmaIOTjsonController.h 7KB
haSensor.h 6KB
espnow_hal.h 5KB
cryptModule.h 5KB
EnigmaIoTconfigAdvanced.h 5KB
EnigmaIOTRingBuffer.h 4KB
Comms_hal.h 4KB
EnigmaIoTconfig.h 4KB
BasicController.h 4KB
SmartSwitchController.h 4KB
GwOutput_generic.h 3KB
GatewayAPI.h 3KB
EnigmaIOTdebug.h 3KB
GwOutput_dummy.h 3KB
ds18b20Controller.h 3KB
helperFunctions.h 3KB
LedController.h 3KB
Filter.h 3KB
ButtonController.h 3KB
DashButtonController.h 3KB
timeManager.h 2KB
dstrootca.h 1KB
EnigmaIOTNode_8cpp_source.html 656KB
EnigmaIOTGateway_8cpp_source.html 482KB
classEnigmaIOTNodeClass.html 234KB
GwOutput__mqtt_8cpp_source.html 195KB
classCONTROLLER__CLASS__NAME.html 179KB
EnigmaIOTNode_8h_source.html 170KB
classEnigmaIOTGatewayClass.html 167KB
NodeList_8h_source.html 140KB
SmartSwitchController_8cpp_source.html 137KB
EnigmaIOTGateway_8h_source.html 133KB
EnigmaIOTGatewayMQTT_8cpp_source.html 128KB
classNode.html 122KB
haEntity_8h_source.html 108KB
GatewayAPI_8cpp_source.html 101KB
NodeList_8cpp_source.html 100KB
EnigmaIOTGatewayDummy_8cpp_source.html 88KB
espnow__hal_8cpp_source.html 67KB
共 926 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9149
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 虚拟电脑病毒无害无需资源
- 探索Python数据可视化:Matplotlib库的深入指南
- 全站数据爬取技术与实践:方法、代码与策略
- 微信自动抢红包APP.zip毕业设计参考学习资料
- 为 Wireshark 能使用纯真网络 IP 数据库(QQwry)而提供的格式转换工具.zip
- 音频格式转换工具.zip学习资料程序资源
- 自用固件,合并openwrt和immortalwrt编译AX6(刷机有风险).zip
- 最新GeoLite2-City.mmdb,GeoLite2-Country.mmdb打包下载
- 基于BootStrap + Springboot + FISCO-BCOS的二手物品交易市场系统.zip
- 使用Java语言编写的九格拼游戏,找寻下曾经小时候的记忆.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功