-
Notifications
You must be signed in to change notification settings - Fork 852
Add key generation for private encryption key #2559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add key generation for private encryption key #2559
Conversation
Todo : to make rigth prng we need to use stm32 prng drivers. (hw drivers)
…for hwrng and gen key
de-nordic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Heh, I did not even see feature proposal for that in issues.
I am not sure whether description in this PR is just making shortcuts, but as far as I can tell AES is used for encryption, ec255 is used for encryption key exchange using DH.
Anyway, my main issue with the PR: if you have a way to ask a device for a key on the first boot, that has been written by a device itself to itself, you have a way to provision one of the pair you generate outside of a device and just obliterate the original private key.
And why bloat the device into certificate generator, by adding the der and pem encoder.
|
@de-nordic we reached out to David on Discord regarding this topic, and he suggested opening a PR. For ECIES, each device needs its own key pair. Currently, these key pairs are generated by the imagetool (we refer to them as “encryption keys” for simplicity). The private key is compiled into the bootloader code via the key.h file. This approach means that once the bootloader is compiled, all devices flashed with that image share the same encryption key pair. In a large fleet of devices, having identical encryption keys is a significant security concern. To address this, we decided that each device should have its own unique encryption key pair. There are two possible approaches:
The idea is to generate the encryption key pair during the first boot of the device, store the private key in a secure key storage unit inside the chip, and expose the public key over a secure production interface. |
|
@de-nordic If I understand your concern correctly, it’s about preventing the device from generating a new key pair on the next boot? If i get it wrong please correct me |
Current Implementation
In the default Mcuboot implementation, the private key used for firmware decryption is compiled directly into the bootloader binary.
New functionalities in this PR
During the first boot, the microcontroller automatically generates a key pair. The process includes:
The private key remains stored in a secure area of the microcontroller and is never exposed. The public key can be retrieved during the update.