如何在嵌入式系统上进行数据存储的连续不良加密

发布于 2025-02-04 19:42:44 字数 572 浏览 2 评论 0原文

这是一个“概念”问题,而不是一个真实的编程问题。但是,必须牢记限制在嵌入式系统上工作。

这是一点上下文:我正在研究一个使用STM32原型板(STM32G431KB的项目)经过身份验证的人将能够阅读它们。我想避免对称加密,因为它不像不对称的那样安全。

文件存储在SDCARD上。而且特殊性是我需要“即时”加密它们。我计划大约每秒获取数据并将其添加到文件中。在每个数据保存上重新加密整个文件不是一个解决方案,因为这些解决方案可能很大。

所以,我的问题是:我该如何实现?

我完全熟悉这种担忧,并想知道是否有经验丰富的人可以分享一些我可以搜索的技巧或东西。我认为Hybrid加密在我的约束方面可能最合适,但是,我不确定这是使用它的正确方法:

  • 生成一对私有/公共密钥,并
  • 使用公共密钥 将私有的私钥存储在设备上加密在受信任主机上生成的对称键
  • 在设备启动上获取此密钥,并使用CBC加密来对文件进行加密,

这是这样的设置的缺陷?

PS :只是为了澄清,该设备未连接到Internet。与主机的唯一交互是通过串行通信或仅将数据读取/写入SDCARD

This is more a "concept" question than a real programing one. However, having to constraint to work on embedded systems have to be kept in mind.

Here is a little bit of context : I am working on a project that uses an stm32 prototyping board (STM32G431KB to be precise, bare-metal (so C / C++) ) and my goal is to safely store sensitive data in files so that only an authenticated person would be able to read them. I would like to avoid symmetric encryption as it is not as safe as asymmetric.

Files are stored on an SDCard. And the particularity is that I need to encrypt them "on the fly". I plan to acquire data approximately every second and add them to a file. Re-encrypting the whole file at each data save is not a solution as these ones may be large.

So, my question is : how could I achieve this?

I am completely new to this kind of concerns and would like to know if someone more experienced could share a few tips or things I could search. I assume that hybrid encryption could be the most suitable regarding my constraints, however, I am not sure this would be a correct way to use it :

  • Generate a pair of private/public key and store the private on the device
  • Using the public key to encrypt a symmetric key generated on a trusted host
  • Get this key on device startup and use it to encrypt the file using CBC encryption

What would be the flaws of such a setup?

PS : just to clarify, the device is not connected to internet. The only interactions possible with a host would be over serial communication or just reading/writing data to the sdcard

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文