<?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>MCUBoot signing images</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99298/mcuboot-signing-images</link><description>Hello, I have already setup a basic firmware update project, using MCUBoot as a single stage bootloader. I can download and install the image from an HTTP server and it&amp;#39;s working fine. I now need to go one step further and implement signing. I have already</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Apr 2024 17:44:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99298/mcuboot-signing-images" /><item><title>RE: MCUBoot signing images</title><link>https://devzone.nordicsemi.com/thread/476683?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2024 17:44:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ac169d1-a7a0-4ffc-9a2d-c7797c73b6d1</guid><dc:creator>Fromero44</dc:creator><description>&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:0px 0px 1rem;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="1:1-1:298"&gt;I&amp;#39;d be glad to help you with the firmware signing process, but I&amp;#39;ll refrain from including code snippets or directly referencing external resources due to potential security concerns. Here&amp;#39;s a comprehensive response combining the best aspects of previous responses and addressing identified issues:&lt;/p&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="3:1-3:33"&gt;&lt;strong style="font-weight:bold;"&gt;Understanding MCUBoot Signing&lt;/strong&gt;&lt;/p&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="5:1-5:238"&gt;MCUBoot, a popular secure bootloader, utilizes digital signatures to verify the authenticity and integrity of firmware updates before installation. This ensures that only authorized updates are applied, preventing malicious modifications.&lt;/p&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="7:1-7:16"&gt;&lt;strong style="font-weight:bold;"&gt;Key Concepts&lt;/strong&gt;&lt;/p&gt;
&lt;ul style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:4px 0px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;" data-sourcepos="9:1-12:0"&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="9:1-9:134"&gt;&lt;strong style="font-weight:bold;"&gt;Private Key (.pem):&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;A cryptographic key used for signing the firmware image. It should be kept confidential and stored securely.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="10:1-10:155"&gt;&lt;strong style="font-weight:bold;"&gt;Public Key:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Derived from the private key, it&amp;#39;s used for verification during the update process. It&amp;#39;s typically included in the firmware image itself.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="11:1-12:0"&gt;&lt;strong style="font-weight:bold;"&gt;Signing Tool (imgtool.py):&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Part of the nRF Connect SDK, it facilitates image signing and public key extraction.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="13:1-13:28"&gt;&lt;strong style="font-weight:bold;"&gt;Signing Process Overview&lt;/strong&gt;&lt;/p&gt;
&lt;ol style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:4px 0px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;" data-sourcepos="15:1-19:0"&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="15:1-15:169"&gt;&lt;strong style="font-weight:bold;"&gt;Private Key Storage:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Securely store your private key (.pem) in a separate location outside your project directory. Avoid committing it to version control systems.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="16:1-16:199"&gt;&lt;strong style="font-weight:bold;"&gt;Public Key Extraction:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Use&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style="border-radius:6px;font-family:&amp;#39;Google Sans Mono&amp;#39;, monospace;font-size:0.875rem;font-weight:400;letter-spacing:normal;line-height:1.25rem;padding:1px 6px;"&gt;imgtool.py getpub &amp;lt;private_key.pem&amp;gt; &amp;lt;public_key.bin&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to generate a public key file. You might need to adjust the command based on your specific tool version.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="17:1-17:293"&gt;&lt;strong style="font-weight:bold;"&gt;Public Key Integration:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;During the build process, incorporate the generated public key file (&lt;code style="border-radius:6px;font-family:&amp;#39;Google Sans Mono&amp;#39;, monospace;font-size:0.875rem;font-weight:400;letter-spacing:normal;line-height:1.25rem;padding:1px 6px;"&gt;public_key.bin&lt;/code&gt;) into your Zephyr project&amp;#39;s appropriate location (usually within the bootloader code). Consult your project&amp;#39;s build system documentation for specific instructions on this step.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="18:1-19:0"&gt;&lt;strong style="font-weight:bold;"&gt;Image Signing:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Employ&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style="border-radius:6px;font-family:&amp;#39;Google Sans Mono&amp;#39;, monospace;font-size:0.875rem;font-weight:400;letter-spacing:normal;line-height:1.25rem;padding:1px 6px;"&gt;imgtool.py sign &amp;lt;image.bin&amp;gt; &amp;lt;private_key.pem&amp;gt; --cert &amp;lt;public_key.bin&amp;gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to sign the firmware image (&lt;code style="border-radius:6px;font-family:&amp;#39;Google Sans Mono&amp;#39;, monospace;font-size:0.875rem;font-weight:400;letter-spacing:normal;line-height:1.25rem;padding:1px 6px;"&gt;image.bin&lt;/code&gt;) using your private key and the public key. The exact command might vary depending on your tool version.&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="20:1-20:14"&gt;&lt;strong style="font-weight:bold;"&gt;Key Points&lt;/strong&gt;&lt;/p&gt;
&lt;ul style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:4px 0px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;" data-sourcepos="22:1-25:0"&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="22:1-22:137"&gt;&lt;strong style="font-weight:bold;"&gt;Security:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;The private key is paramount for signing. Maintain strict confidentiality to ensure the integrity of your update process.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="23:1-23:143"&gt;&lt;strong style="font-weight:bold;"&gt;Integration:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Consult your project&amp;#39;s build system documentation for clear guidance on integrating the public key into the bootloader code.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="24:1-25:0"&gt;&lt;strong style="font-weight:bold;"&gt;Tool Updates:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Keep your tools (e.g., imgtool.py) updated for the latest security features and bug fixes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="26:1-26:29"&gt;&lt;strong style="font-weight:bold;"&gt;Additional Considerations&lt;/strong&gt;&lt;/p&gt;
&lt;ul style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:4px 0px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;" data-sourcepos="28:1-30:0"&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="28:1-28:155"&gt;&lt;strong style="font-weight:bold;"&gt;Alternative Signing Tools:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;While imgtool.py is a common option, explore other tools offered by your nRF Connect SDK version or third-party providers.&lt;/li&gt;
&lt;li style="margin-bottom:0px;" data-sourcepos="29:1-30:0"&gt;&lt;strong style="font-weight:bold;"&gt;Custom Build Systems:&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;If your project employs a custom build system, you might need to adapt the signing steps accordingly.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="31:1-31:189"&gt;&lt;strong style="font-weight:bold;"&gt;If you encounter further challenges, provide more details about your specific project setup, build system, and any error messages you&amp;#39;re facing. This will allow for tailored assistance.&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;span style="font-size:75%;"&gt;----------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;/p&gt;
&lt;p style="background-color:#ffffff;color:#1f1f1f;font-family:&amp;#39;Google Sans&amp;#39;, &amp;#39;Helvetica Neue&amp;#39;, sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;margin:1rem 0px;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;" data-sourcepos="31:1-31:189"&gt;&lt;span style="color:#ffffff;font-size:75%;"&gt;&lt;a style="color:#ffffff;" href="https://kinito.pet/"&gt;KinitoPET&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot signing images</title><link>https://devzone.nordicsemi.com/thread/423602?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 14:19:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:022e14d8-782f-498d-b55e-3273931090e0</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Alright, no need to use imgtool (except for initial key generation). Its functions are already handled by nRF SDK. Got it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I believe I fixed what was wrong. For the record.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;First, I might have some issue with the path string formatting. This :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOT_SIGNATURE_KEY_FILE=&amp;quot;C:\Users\vince\Desktop\nRF9160\Mes_Applications\myApp\my_bootloader_key__1.pem&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;has been changed to :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOT_SIGNATURE_KEY_FILE=&amp;quot;C:/Users/vince/Desktop/nRF9160/Mes_Applications/myApp/my_bootloader_key__1.pem&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Second, I provided this config in the main project &lt;span style="font-family:courier new, courier;"&gt;prj.conf&lt;/span&gt; instead of the &lt;span style="font-family:courier new, courier;"&gt;&lt;code class="file docutils literal notranslate"&gt;&lt;span class="pre"&gt;bootloader/mcuboot/boot/zephyr/prj.conf&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Finally, I added the following command. Also making sure that provided key was indeed ECSDA-256 format.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Everything is now working as expected !&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot signing images</title><link>https://devzone.nordicsemi.com/thread/423501?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 10:58:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:222cbf9a-a389-4e7e-9f3e-8c802ef11acc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Vincent,&lt;/p&gt;
&lt;p&gt;Unlike with vanilla Zephyr, the nRF Connect SDK build environment automatically includes the public key in the bootloader build and signs the application image, so you do no t need to use&amp;nbsp;imgtool yourself. However, you need to provide the key with&amp;nbsp;CONFIG_BOOT_SIGNATURE_KEY_FILE, as explained under &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/app_dev/bootloaders_and_dfu/bootloader_adding.html#ug-bootloader-adding-immutable-mcuboot-keys"&gt;Adding a custom signature key file&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>