<?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>Custom Signing Function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114394/custom-signing-function</link><description>NCS v2.7.0 and sysbuild system. 
 I&amp;#39;m looking for some clarification about Secure Boot and implementing a custom signing command. 
 What is the difference between secure boot and the signing that happens when you just set BOOT_SIGNATURE_KEY_FILE=&amp;quot;/path</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Sep 2024 13:56:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114394/custom-signing-function" /><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501392?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 13:56:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2c68475-e406-4d8c-8854-d9f2d5dc167c</guid><dc:creator>Roedy</dc:creator><description>&lt;p&gt;Thanks Sigurd, I appreciate all of the insight.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501388?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 13:49:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9ecd745-e677-49ab-9e41-ff2fd9dc224f</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Mentioning this to the devs, they agree that modifying imgtool is the best way. But to give you a possible alternative, they say:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;for mcuboot they can use a custom signing script, they&amp;#39;d want to base it off whichever one they are using (which depends on the mode of their application) &lt;a title="https://github.com/nrfconnect/sdk-nrf/tree/main/cmake/sysbuild" href="https://github.com/nrfconnect/sdk-nrf/tree/main/cmake/sysbuild" rel="noopener noreferrer" target="_blank"&gt;https://github.com/nrfconnect/sdk-nrf/tree/main/cmake/sysbuild&lt;/a&gt;&amp;nbsp;one of the image_signing files, they would need to set this from sysbuild, doing so is a bit convoluted... Modifying imgtool is probably what they would want anyway&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501386?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 13:44:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:533173fc-d995-40f1-8691-da480bbdf562</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="Roedy"]I can get the public key out of the system and store it as a file.&amp;nbsp; The issue is that when I actually need to do the signature from an HSM it isn&amp;#39;t just a file that I can load.&amp;nbsp; We&amp;#39;re using a cloud based HSM, so I need to make an API call to my cloud service to generate the signature.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If we were using a local HSM (like a yubi key, for instance) we&amp;#39;d still need to use some sort of library to load the key reference, for example&amp;nbsp;&lt;a href="https://python-pkcs11.readthedocs.io/en/latest/index.html"&gt;https://python-pkcs11.readthedocs.io/en/latest/index.html&lt;/a&gt;[/quote]
&lt;p&gt;Right, that makes it harder then.&lt;/p&gt;
[quote user="Roedy"]The way that you guys included the&amp;nbsp;SB_CONFIG_SECURE_BOOT_SIGNING_COMMAND option for the nordic bootloader is wonderful, and is &lt;strong&gt;exactly&lt;/strong&gt;&amp;nbsp;what I was looking for, but I think I&amp;#39;m stuck with mcuboot at the moment so I&amp;#39;ll probably just modify the imgtool to do what I need it to do.[/quote]
&lt;p&gt;I agree that this seems like the way. &lt;br /&gt;Thanks for the feedback on this though; I will forward it to our bootloader team.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501187?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 14:00:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0934a083-81cf-4887-bf04-d9289adbaf10</guid><dc:creator>Roedy</dc:creator><description>&lt;p&gt;I can get the public key out of the system and store it as a file.&amp;nbsp; The issue is that when I actually need to do the signature from an HSM it isn&amp;#39;t just a file that I can load.&amp;nbsp; We&amp;#39;re using a cloud based HSM, so I need to make an API call to my cloud service to generate the signature.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If we were using a local HSM (like a yubi key, for instance) we&amp;#39;d still need to use some sort of library to load the key reference, for example&amp;nbsp;&lt;a id="" href="https://python-pkcs11.readthedocs.io/en/latest/index.html"&gt;https://python-pkcs11.readthedocs.io/en/latest/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The way that you guys included the&amp;nbsp;SB_CONFIG_SECURE_BOOT_SIGNING_COMMAND option for the nordic bootloader is wonderful, and is &lt;strong&gt;exactly&lt;/strong&gt;&amp;nbsp;what I was looking for, but I think I&amp;#39;m stuck with mcuboot at the moment so I&amp;#39;ll probably just modify the imgtool to do what I need it to do.&lt;br /&gt;&lt;br /&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501099?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 08:30:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78674f1a-745f-4570-8b2a-ca0a111fbd4f</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;The post you found is for the old SDK, so it is not as relevant.&lt;br /&gt;But yes, this is something other users have asked about earlier as well.&lt;/p&gt;
&lt;p&gt;That being said, I find it a bit strange that you are unable to get the public key out of your system. It is after all &lt;strong&gt;public&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;But oh well, you work with what you got.&lt;br /&gt;To make your own signing functionality, imgtool is open source, so you can have a look at its &lt;a href="https://github.com/mcu-tools/mcuboot/tree/main/scripts/imgtool"&gt;source code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To understand the MCUboot image layout which you need to achieve, see &lt;a href="https://www.youtube.com/watch?v=qMMD0WcKShc"&gt;https://www.youtube.com/watch?v=qMMD0WcKShc&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501014?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 15:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35ec45f4-7c3d-47c5-82ba-fa6eadf7bfac</guid><dc:creator>Roedy</dc:creator><description>&lt;p&gt;I think I will need to write my own image signing script, because the pub/priv keys are stored in a cloud HSM.&amp;nbsp; This just popped up the related section, so it seems like others are trying to do this as well.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/113154/aws-key-management-system---dfu-package-signing"&gt;AWS Key Management System - DFU Package Signing&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It would be nice to include a feature to imgtool where a user can&amp;nbsp;implement custom `get_pub_key` and `sign` functions&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501011?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 14:55:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af85bdfb-cbe5-42bb-80e3-3ad631ea938a</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;I recommend using only MCUboot if you want just one bootloader.&lt;/p&gt;
&lt;p&gt;MCUboot does not have a feature to input the public key, so this must be done manually. It is not an issue, just a bit finicky.&lt;/p&gt;
&lt;p&gt;I did a sample for it here:&lt;/p&gt;
&lt;p&gt;&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;p&gt;Is this what you need?&lt;/p&gt;
&lt;p&gt;PS: The sample uses the old multi-image build system, and thus the configuration method will be some changes with sysbuild.&lt;br /&gt;I beleive that for the most part, you can just rename the child_image/ folder to sysbuild/, and then move some stuff from prj.conf to sysbuild.conf. See &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/releases_and_maturity/migration_guides.html"&gt;Sysbuild migration guide&lt;/a&gt; for more in depth info, and &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/serial_recovery/mcuboot_serial_recovery_uart_sysbuild"&gt;this other sample&lt;/a&gt; where I have converted one of my samples to sysbuild so far.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/501006?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 14:34:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f099608-8991-4e15-9180-13f73acbd27e</guid><dc:creator>Roedy</dc:creator><description>&lt;p&gt;Ahh, okay I see where the confusion is.&amp;nbsp; I was under the impression that I was using MCUboot, but I see that enabling CONFIG_SECURE_BOOT is enabling the NSIB.&amp;nbsp; I think I just saw the custom signing script and jumped to implementation.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t need two bootloader necessarily, but my current implementation is relying on mcuboot style image headers for updates and I&amp;#39;m running code in direct XIP mode with a primary and secondary slot from internal flash only.&lt;/p&gt;
&lt;p&gt;I do require a custom signing command, as my code is signed by a HSM and I don&amp;#39;t have access to the private key.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m pretty flexible at the moment, so with those requirements in mind, can you suggest a path forward?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Signing Function</title><link>https://devzone.nordicsemi.com/thread/500718?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2024 09:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d51f6776-fbfb-43f0-a0f1-82fb5f526660</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We got two different bootloaders:&lt;br /&gt;MCUboot and Nordic Secure Immutable Bootloader (NSIB).&lt;br /&gt;Which one of these do you refer to?&lt;/p&gt;
&lt;p&gt;How many bootloaders do you plan to use?&lt;/p&gt;
&lt;p&gt;For general info, see &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/mcuboot_nsib/bootloader_mcuboot_nsib.html"&gt;our bootloader docs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>