<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Multiple MCUBoot Keys and Securing a Private Key</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111721/multiple-mcuboot-keys-and-securing-a-private-key</link><description>Using SDK 2.4.2 
 1) Is there a way to specify multiple MCUBoot keys in the same way they can be specified for NSIB? MCU Boot allows an array of keys, but it looks like zephyr hardcodes it to one key, and I would have to modify keys.c to accommodate an</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Jun 2024 07:29:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111721/multiple-mcuboot-keys-and-securing-a-private-key" /><item><title>RE: Multiple MCUBoot Keys and Securing a Private Key</title><link>https://devzone.nordicsemi.com/thread/487428?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 07:29:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79f9ee65-12eb-4baa-beb6-839a41a86fd7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="eric_dyke"]It just means there are ways to leak the key (e.g. modify the script) as opposed to using a separate signing service that never reveals the key.[/quote]
&lt;p&gt;Yes, that is correct. But you are free to change this and sign the image separately outside of the build process, even though it is not directly supported in the SDK. Oen way to do this is shown in &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_manual_sign"&gt;this unoficcial sample&lt;/a&gt;.&lt;/p&gt;
[quote user="eric_dyke"]The real gain would be reduced complexity and need to juggle another image for MCUboot in addition to the ability to use the existing hooks NISB provides for signing services and multiple public keys that can be revoked.[/quote]
&lt;p&gt;I see. That is a valid point. But then you would end up expanding NCIB &lt;em&gt;a lot&lt;/em&gt;, so I am not sure the compexity would be that much smaller (though you would have one less bootloader).&amp;nbsp; And as this is non-upgradable, you would incrase the risk of discovering a critical bug in a software component that cannot be updated in the field.&amp;nbsp;That is at least worth keeping in mind.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple MCUBoot Keys and Securing a Private Key</title><link>https://devzone.nordicsemi.com/thread/487369?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 15:41:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1809b0db-77bd-459f-a342-6029ececcd88</guid><dc:creator>EDLT</dc:creator><description>&lt;p&gt;Thanks for the lengthy response. This makes sense.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/111721/multiple-mcuboot-keys-and-securing-a-private-key/487228"]The private key does not reside on the device, so this is not exposed.[/quote]
&lt;p&gt;I mean to say the key has to exist alongside the code base during compile time. It just means there are ways to leak the key (e.g. modify the script) as opposed to using a separate signing service that never reveals the key.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/111721/multiple-mcuboot-keys-and-securing-a-private-key/487228"]NSIB is a minimal bootloader that does not support network core updates (or any other features othar than what is strictly needed for the indended use case). So then you would have to implement that youself, and I am not sure you would gain much?[/quote]
&lt;p&gt;The real gain would be reduced complexity and need to juggle another image for MCUboot in addition to the ability to use the existing hooks NISB provides for signing services and multiple public keys that can be revoked.&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple MCUBoot Keys and Securing a Private Key</title><link>https://devzone.nordicsemi.com/thread/487228?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 07:54:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd417c3e-d801-41b5-9d08-63af9ceea492</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Your understanding is mostly correct.&lt;/p&gt;
[quote user="eric_dyke"]But still, the keys used to sign the application are potentially exposed.[/quote]
&lt;p&gt;I do not understand what you refer to here though? MCUBoot contains the public key needed to verify the application images, but this is not a secret. The private key does not reside on the device, so this is not exposed.&lt;/p&gt;
[quote user="eric_dyke"]Won’t we need to do a multi-image OTA so that the new MCUboot and newly signed application are able to be installed consecutively.[/quote]
&lt;p&gt;Yes, if you change the MCUboot key used to validate the application, you will need to update both MCUboot and the application simultaniously. This should not be a problem though. Wiht an upgradable bootloader, you have a secondary slot for the bootloader, and you also have a separate secondary slot for the application. In order to simultaniously update,&amp;nbsp;transver both the new MCUboot and the new application, which then reside in their separate secondary slots, and activate the new applicatio image. What happens then is that when the device is reset, the secure immutable bootloader which is the first stage bootloader will see that there is a newer MCUboot version, and boot that. This in turn will check the metadata on the secondary slot and see that there is a new image to be activated, and activate that.&lt;/p&gt;
&lt;p&gt;Note that if you want revokable keys in MCUboot you should validate that this works, but most likely, you will never have to do this operation in the field (it is only relevant if you suspect that the private key used to sign applications has been leaked or otherwise compromised).&lt;/p&gt;
[quote user="eric_dyke"]With MCUboot I can use the DFU target library, what’s the corresponding API or library to use with NSIB?[/quote]
&lt;p&gt;You can use the DFU target library for NSIB updates as well (it is covered by the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/dfu/dfu_target.html#mcuboot-style-upgrades"&gt;MCUboot style upgrades&lt;/a&gt;). But there are also other posibilities, like SMP, as demonstrated by the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html"&gt;SMP Server sample&lt;/a&gt;.&lt;/p&gt;
[quote user="eric_dyke"]How do I setup the multi-image update so I don’t brick my devices?[/quote]
&lt;p&gt;Multi image DFU for the nRF53 in general (including net core image) is perhaps a separate discussion, but in the context of this case the potential problem is with mismatch of the application and immutable bootloader key. I must say that I have not tested this myself nor seen an example of it being used, but from what I can see, this order of operation should be safe:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First write the application update signed with the new key (for instance via SMP) image to the secondary slot and mark for activation.
&lt;ol&gt;
&lt;li&gt;If for some reason a reset happens at this point, the old MCUboot will not activate the image, and it will not be activated. So the device will still bot into the old application.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Secondly, write the MCUboot application.
&lt;ol&gt;
&lt;li&gt;Uplon reset, NSIB will boot the&amp;nbsp;new MCUboot (as it has the highest version number).&lt;/li&gt;
&lt;li&gt;The new MCUboot has the new public key and will validate the new application image in the secondary slot, activate and boot it.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
[quote user="eric_dyke"]If I want to also use MCUboot with external flash to make room for a large application, is this still possible?[/quote]
&lt;p&gt;Yes, using MCUboot with external flash is common and supported. The secondary slot for the applicaiton can be placed in external flash.&lt;/p&gt;
[quote user="eric_dyke"]As an alternative idea, what would prevent the use of NSIB by itself without MCUboot? [/quote]
&lt;p&gt;NSIB is a minimal bootloader that does not support network core updates (or any other features othar than what is strictly needed for the indended use case). So then you would have to implement that youself, and I am not sure you would gain much?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple MCUBoot Keys and Securing a Private Key</title><link>https://devzone.nordicsemi.com/thread/487152?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 14:37:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae47be6e-ca5e-47e8-8dbd-65441a3a7024</guid><dc:creator>EDLT</dc:creator><description>&lt;p&gt;Einar,&lt;/p&gt;
&lt;p&gt;Thanks. I think using NSIB as the first stage bootloader might work. I like that it has all the right elements to keep keys secure and to be able to revoke keys. Can you confirm my understanding of how image validation, boot, and update would work in this case:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understanding so far:
&lt;ul&gt;
&lt;li&gt;NSIB validates the current MCUboot version and new MCUboot images to be installed.&lt;/li&gt;
&lt;li&gt;MCUboot validates the current and new application images. We can change keys used to sign the application by upgrading MCUboot. But still, the keys used to sign the application are potentially exposed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Concerns:
&lt;ul&gt;
&lt;li&gt;Won&amp;rsquo;t we need to do a multi-image OTA so that the new MCUboot and newly signed application are able to be installed consecutively. Otherwise, we could install a new MCUboot version with an old application which it can&amp;rsquo;t boot. &lt;strong&gt;I don&amp;rsquo;t quite understand how to do this with the two bootloaders. &lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;With MCUboot I can use the DFU target library, what&amp;rsquo;s the corresponding API or library to use with NSIB?&lt;/li&gt;
&lt;li&gt;How do I setup the multi-image update so I don&amp;rsquo;t brick my devices?&lt;/li&gt;
&lt;li&gt;If I want to also use MCUboot with external flash to make room for a large application, is this still possible?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As an alternative idea, what would prevent the use of NSIB by itself without MCUboot? We would need to use the PCD library to perform a netcore update, but that could be run from the application or the application bootloader, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple MCUBoot Keys and Securing a Private Key</title><link>https://devzone.nordicsemi.com/thread/487129?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 12:53:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05b9097b-9867-4231-8b78-38d146ecba9b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. We do not support mutliple revokable keys for MCUboot. It should not be needed if MCUboot is used as second stange bootloader though, as in that case, revoking a the public key in MCUboot can be in form of updating to a newer MCUboot version.&lt;/p&gt;
&lt;p&gt;2. There is no equivablent for MCUboot as far as I am aware. However, nothing prevents you from&amp;nbsp;replacing the dignature trailer in the hex file directly as yo write, that&amp;nbsp;will work. Or take the un-signed binary and sign it yourself with imgtool.py and use the resulting signed image.&lt;/p&gt;
&lt;p&gt;3. Pointing to just the public key (which is what you want if you are signing separately to better protect the private key) is not directly support in Kconfig, but there is a unofficial sample that demonstrate how you can do it: &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_manual_sign"&gt;MCUBoot sample using SMP Server and manually signed images&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>