<?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>Application with MCUBoot and external signature</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120688/application-with-mcuboot-and-external-signature</link><description>Hello everyone, 
 I&amp;#39;m working on a project based on the nRF52840, and I&amp;#39;m using nRF Connect SDK 2.9.0. The project uses MCUboot, but the firmware image is signed externally — outside of the build system. I&amp;#39;m looking for guidance on how to configure the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Apr 2025 05:38:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120688/application-with-mcuboot-and-external-signature" /><item><title>RE: Application with MCUBoot and external signature</title><link>https://devzone.nordicsemi.com/thread/531937?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2025 05:38:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a421fcc8-cce2-4f2d-b82b-b41300ed5faf</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="Sigurd Hellesvik"]However, Im not sure I got the sample to work at that time.[/quote]
&lt;p&gt;I see in the PR that I say &lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1744780968002v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;and from this it does look like I got that working after all.&lt;/p&gt;
[quote user="LukaWer"]My actual goal is to inject the public key via configuration, so that it gets included in the MCUboot build, without needing to manually place or modify SDK internals.[/quote]
&lt;p&gt;From what I can find, this is not supported out of the box. &lt;br /&gt;I think the pubkey is generated in &lt;a href="https://github.com/nrfconnect/sdk-mcuboot/blob/81e6fc3041d028000bcc97ec99d1290cf6c172b6/boot/zephyr/CMakeLists.txt#L396-L409"&gt;CMakeListst.txt for MCUboot&lt;/a&gt;. &lt;br /&gt;If you want, you can for example add a new Kconfig symbol and then do an &amp;quot;if/else&amp;quot; here to use your public key instead generating it here, I think.&lt;/p&gt;
[quote user="LukaWer"]To add some context: this configuration is being applied in a CI pipeline, where we don&amp;#39;t have access to the private key — signing is handled externally, in a secure environment.[/quote]
&lt;p&gt;Yes, this is why the PR I linked below lets you take in just the signature. &lt;br /&gt;On the same topic, I found this git issue as well: &lt;a href="https://github.com/mcu-tools/mcuboot/issues/1519"&gt;https://github.com/mcu-tools/mcuboot/issues/1519&lt;/a&gt;. Did not look that close at it, but it seems relevant &amp;quot;I have been trying to move my project over from being signed by a local signing key to an external signing service.&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application with MCUBoot and external signature</title><link>https://devzone.nordicsemi.com/thread/531826?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 11:46:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e288b465-d574-4287-a17c-ce0ca7770ad5</guid><dc:creator>LukaWer</dc:creator><description>&lt;p class="" data-start="119" data-end="129"&gt;Hi Sigurd,&lt;/p&gt;
&lt;p class="" data-start="131" data-end="184"&gt;Thank you very much for the quick and detailed reply!&lt;/p&gt;
&lt;p class="" data-start="186" data-end="391"&gt;I forgot to mention earlier that I&amp;rsquo;m using &lt;strong&gt;&lt;/strong&gt;Sysbuild&amp;nbsp;in my setup (NCS 2.9.0), so the example you shared doesn&amp;rsquo;t directly apply &amp;mdash; although it&amp;rsquo;s still very helpful for understanding the general mechanism.&lt;/p&gt;
&lt;p class="" data-start="393" data-end="564"&gt;My actual goal is to inject the public key via configuration, so that it gets included in the MCUboot build, without needing to manually place or modify SDK internals.&lt;/p&gt;
&lt;p class="" data-start="566" data-end="1144"&gt;I&amp;rsquo;ve been analyzing the build process in NCS, and unfortunately, it seems that disabling the automatic inclusion of &lt;code data-start="684" data-end="705"&gt;image_signing.cmake&lt;/code&gt; is not currently supported. I&amp;rsquo;ve tried using &lt;code data-start="753" data-end="769"&gt;SIGNING_SCRIPT&lt;/code&gt; and &lt;code data-start="774" data-end="814"&gt;CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE&lt;/code&gt;, but neither had the desired effect. Even though I was able to inject the public key successfully using &lt;code data-start="919" data-end="954"&gt;SB_CONFIG_BOOT_SIGNATURE_KEY_FILE&lt;/code&gt;, the build system still passes that key to &lt;code data-start="998" data-end="1007"&gt;imgtool&lt;/code&gt; in the post-build step, which then tries to sign the image and causes the &lt;code data-start="1082" data-end="1094"&gt;west build&lt;/code&gt; to fail &amp;mdash; since the private key is not available.&lt;/p&gt;
&lt;p class="" data-start="1146" data-end="1328"&gt;To add some context: this configuration is being applied in a CI pipeline, where we don&amp;#39;t have access to the private key &amp;mdash; signing is handled externally, in a secure environment.&lt;/p&gt;
&lt;p class="" data-start="1330" data-end="1512"&gt;Thanks again for sharing the links and information. It&amp;#39;s been very helpful in understanding the flow.&lt;/p&gt;
&lt;p class="" data-start="1514" data-end="1541"&gt;Best regards,&lt;/p&gt;
&lt;p class="" data-start="1514" data-end="1541"&gt;Lukasz&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application with MCUBoot and external signature</title><link>https://devzone.nordicsemi.com/thread/531823?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 11:24:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3113dd1d-532b-4837-9b2b-93ab8cc77043</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]&lt;span&gt;Provide the public key to the MCUboot build process (so it can verify signatures). I do not have access to firmware private key.&lt;/span&gt;[/quote]
&lt;p&gt;I got an example where I tried to do this. I last updated it for v2.5.2 or something like that, but the general method should still be the same:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cp keys/test_pub.c build/mcuboot/zephyr/autogen-pubkey.c&lt;/code&gt;&lt;/pre&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;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_manual_sign&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, this does still need you to have access to the private key to sign your images.&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;span&gt;Prevent automatic image signing (image_signing.cmake) by the build system, as signing will be handled separately.&lt;/span&gt;[/quote]
&lt;p&gt;Here I got a sample that is built on &lt;a href="https://github.com/mcu-tools/mcuboot/pull/1329"&gt;https://github.com/mcu-tools/mcuboot/pull/1329&lt;/a&gt;. Sample:&lt;br /&gt;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_detached_signature"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_detached_signature&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, Im not sure I got the sample to work at that time.&lt;/p&gt;
&lt;p&gt;It might be easier for you to provide the signature manually. From &lt;a href="https://github.com/mcu-tools/mcuboot/blob/main/docs/signed_images.md"&gt;MCUboot docs&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&amp;quot;This signs the image by computing hash over the image, and then signing that hash. ... This signature is placed in the image trailer.&amp;quot;&lt;/p&gt;
&lt;p&gt;If you watch &lt;a href="https://www.youtube.com/watch?v=qMMD0WcKShc"&gt;this video&lt;/a&gt; in MCUboot flash layout, perhaps that helps.&lt;/p&gt;
&lt;p&gt;I hope this information can help you on your way.&lt;/p&gt;
&lt;p&gt;Let me know if you got any questions along the way!&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>