# GCMEncryption
[](https://registry.platformio.org/libraries/johboh/GCMEncryption)
[](https://components.espressif.com/components/johboh/gcmencryption)
[](https://downloads.arduino.cc/libraries/logs/github.com/Johboh/GCMEncryption/)
[](https://github.com/Johboh/GCMEncryption/releases)
[](https://github.com/Johboh/GCMEncryption)
[](https://github.com/Johboh/GCMEncryption/actions/workflows/test.yaml)
Arduino (using Arduino IDE or PlatformIO) and ESP-IDF (using Espressif IoT Development Framework or PlatformIO) compatible library for encrypting and decrypting byte arrays using AES-128-GCM.
### Packet format & `extended_size`
- `extended_size = false` (default): Uses a compact header (8-byte IV, 8-byte GCM tag, 1-byte length) with a max message length of 230 bytes. Intended for transports with small maximum packet sizes (such as ESP-NOW, IEEE 802.15.4, etc.) and remains wire-compatible with `0.x`.
- `extended_size = true`: Uses hardened GCM parameters (12-byte IV, 16-byte GCM tag, 2-byte length) with a max message length of 65,497 bytes.
### Installation
#### PlatformIO when using the Arduino framework:
Add the following to `lib_deps`:
```
Johboh/GCMEncryption
```
#### PlatformIO when using the ESP-IDF framework:
In your existing `idf_component.yml` or in a new `idf_component.yml` in your `src` or `main` folder:
```
dependencies:
johboh/gcmencryption:
version: ">=1.0.0"
```
#### Arduino IDE:
Search for `GCMEncryption` by `johboh` in the library manager.
#### Espressif IoT Development Framework:
In your existing `idf_component.yml` or in a new `idf_component.yml` next to your `main` folder:
```
dependencies:
johboh/gcmencryption:
version: ">=1.0.0"
```
#### Arduino IDE:
Search for `GCMEncryption` by `johboh` in the library manager. See note about version above.
### Examples
- [Using Arduino IDE/CLI or Platform IO Arduino](examples/arduino/integration/integration.ino)
- [ESP-IDF framework](examples/espidf/integration/main/main.cpp)
### Compatibility
- ESP32 only
### License
Licensed under the GNU General Public License v3.0 or later
da05ec0cd6a54784c3168600d7fa228f53462a2d
idf.py add-dependency "johboh/gcmencryption^1.0.0"