# Kocherga Encrypted images

**URL:** <https://forum.opencyphal.org/t/kocherga-encrypted-images/2021>\
**Category:** Applications & Usage\
**Created:** [November 5, 2023, 8:40pm UTC](https://forum.opencyphal.org/t/kocherga-encrypted-images/2021 "2023-11-05T20:40:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ych](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/ych/32/1510_2.png) [@ych](https://forum.opencyphal.org/u/ych)\
**Post date:** [November 5, 2023, 8:40pm UTC](https://forum.opencyphal.org/t/kocherga-encrypted-images/2021/1 "2023-11-05T20:40:00Z")

</div>

Is there any recommendation to implement encrypted image updates with the Kocherga bootloader?

I am contemplating a security mechanism where a unique key is generated and embedded in each device during its initial firmware flash. Subsequent firmware updates would then be encrypted with this device-specific key. During the update process, only the device holding the corresponding key would be able to decrypt and apply the update. This technique aims to safeguard the firmware content and restrict updates exclusively to the intended recipient device.

Any insights or guidance on this approach would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [November 8, 2023, 7:36am UTC](https://forum.opencyphal.org/t/kocherga-encrypted-images/2021/2 "2023-11-08T07:36:49Z")

</div>

Sure, this should be possible, you just have to extend kocherga properly. Avail yourself to open-source crypto libraries (i.e. [BearSSL](https://bearssl.org/)) and/or integrate with a secure element (i.e. [ATECC608A](https://www.microchip.com/en-us/product/atecc608a)). There is even an application note on implementing secure booting w/ the ATECC608A, see [here](https://ww1.microchip.com/downloads/en/Appnotes/ATECC608-AN2591B-Use-Case-DS00002591B.pdf).

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [November 12, 2023, 5:40pm UTC](https://forum.opencyphal.org/t/kocherga-encrypted-images/2021/3 "2023-11-12T17:40:20Z")

</div>

The problem appears to be only loosely related to Kocherga. Kocherga addresses the problem of transferring the firmware image between the local MCU and a remote file server via Cyphal, plus integrity checking and certain de-bricking logic. The rest is up to the user’s code; this includes the task of image encryption.

---

<div class="post-metadata">

**Author:** ![ych](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/ych/32/1510_2.png) [@ych](https://forum.opencyphal.org/u/ych)\
**Post date:** [November 28, 2023, 12:59pm UTC](https://forum.opencyphal.org/t/kocherga-encrypted-images/2021/4 "2023-11-28T12:59:04Z")

</div>

Reasonable point.

One approach could be to introduce additional flags in the application’s signature, indicating that the firmware payload is encrypted. Alternatively, a more elegant solution might involve using a special extension for the `remote_file_path`. This extension would signify the encrypted nature of the payload, streamlining the process. 🤔

I plan to implement one of these proposed solutions and will report back on the outcomes.
