<?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>steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93315/steps-to-sign-binary-and-encode-the-signed-key-to-mcuboot</link><description>Hi, 
 
 I am using vscode and nCS on windows, kindly help me with below 3 queries: 
 1. How to generate a binary signing key, say &amp;quot;KEY_1&amp;quot;..? 
 2. How to sign a binary with &amp;quot;KEY_1&amp;quot; or generate a signed binary with &amp;quot;KEY_1&amp;quot; from vscode..? 
 3. How to inform</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Dec 2022 13:51:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93315/steps-to-sign-binary-and-encode-the-signed-key-to-mcuboot" /><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/399689?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 13:51:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5a8f0f8-f71e-4309-a082-5f254965f67b</guid><dc:creator>tellg</dc:creator><description>&lt;p&gt;This seems to work:&lt;/p&gt;
&lt;p&gt;set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE \&amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/custom_key_dir/custom_priv.pem\&amp;quot;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/399675?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 13:14:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d99a861c-f2b6-4ad5-a7f1-ba502201d900</guid><dc:creator>tellg</dc:creator><description>&lt;p&gt;Fails&amp;nbsp;in ncs 2.2.0&lt;/p&gt;
&lt;p&gt;(Worked in ncs 2.0.0)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;C:/ncs_proj/samples_for_nrf_connect_sdk-main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf:2: warning: malformed string literal in assignment to BOOT_SIGNATURE_KEY_FILE (defined at C:/ncs/v2.2.0/nrf/modules/mcuboot/boot/zephyr/Kconfig:58, C:/ncs/v2.2.0/bootloader/mcuboot/boot/zephyr/Kconfig:131, C:/ncs/v2.2.0/nrf/modules/mcuboot/Kconfig:3). Assignment ignored.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393610?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 10:13:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9db2c410-9431-4839-806e-36ec500c070e</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;If you want to know more about how signing works with MCUboot, I recommend David Browns video on &lt;a href="https://www.youtube.com/watch?v=JJeGStr009k"&gt; Image signatures in MCUboot &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><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393608?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 10:10:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b01a7c5a-1ba1-4ded-9c39-21788019a664</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/sigurd-hellesvik"&gt;Sigurd Hellesvik&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/93315/steps-to-sign-binary-and-encode-the-signed-key-to-mcuboot/393605"]No. I use &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.1/nrf/app_build_system.html#mcuboot-output-build-files"&gt;app_update.bin.&lt;/a&gt;[/quote]
&lt;p&gt;Thanks. Got it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/93315/steps-to-sign-binary-and-encode-the-signed-key-to-mcuboot/393605"]And not with the asymmetric encryption algorithms(RSA/ECDSA) used for MCUboot i think.[/quote]
&lt;p&gt;I was under the impression that we use salt here as well. But if not, then fine.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your inputs&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/sigurd-hellesvik"&gt;Sigurd Hellesvik&lt;/a&gt;.!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393605?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 10:06:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abd2fce1-26f5-465a-8790-be755b109a25</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="Ubaid_M"]1. After using this key, I am supposed to use the build file &amp;quot;app_signed.hex&amp;quot; for DFU right..?[/quote]
&lt;p&gt;No. I use &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.1/nrf/app_build_system.html#mcuboot-output-build-files"&gt;app_update.bin.&lt;/a&gt;&lt;br /&gt;From &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key"&gt;Custom Key SMP sample&lt;/a&gt;: &lt;/p&gt;
&lt;p&gt;&amp;quot;See the &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/bootloader_samples/smp/mcuboot_smp"&gt;Simple SMP sample&lt;/a&gt; for a guide on how to use the SMP Server.&amp;quot;&lt;/p&gt;
[quote user="Ubaid_M"]2. How can I add salt to the key I am using to sign..?[/quote]
&lt;p&gt;I am a bit confused about this question.&lt;/p&gt;
&lt;p&gt;Salt is mostly used for hashing, right?&lt;br /&gt;And not with the asymmetric encryption algorithms(RSA/ECDSA) used for MCUboot i think.&lt;/p&gt;
&lt;p&gt;Can you elaborate this question a bit?&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><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393574?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 07:47:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37818219-a641-4a17-a826-7b4f31d13807</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/sigurd-hellesvik"&gt;Sigurd Hellesvik&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;I shall try this today.&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/93315/steps-to-sign-binary-and-encode-the-signed-key-to-mcuboot/393483"]My favorite way to do this is to pass it to the CMakeLists.txt.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please help me with two more queries:&lt;/p&gt;
&lt;p&gt;1. After using this key, I am supposed to use the build file &amp;quot;app_signed.hex&amp;quot; for DFU right..?&lt;br /&gt;2. How can I add salt to the key I am using to sign..?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393483?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 13:40:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0e8b32e-dd44-4882-88f2-0ec395d6c639</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user="Ubaid_M"]Please correct me if I am wrong[/quote]
&lt;p&gt;You only need to pass this to the mcuboot child image.&lt;/p&gt;
&lt;p&gt;My favorite way to do this is to pass it to the CMakeLists.txt. This will allow you to use relative paths:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE \\&amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/custom_key_dir/custom_priv.pem\\&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Ref &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key/CMakeLists.txt"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key/CMakeLists.txt&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><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393479?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 13:28:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ae3b65e-5da6-4e69-b5ce-c11b6f526e25</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/sigurd-hellesvik"&gt;Sigurd Hellesvik&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;Thanks I was able to generate a key.&lt;br /&gt;&lt;br /&gt;Now All I need to do is to add the key I generated named &amp;quot;custom_key.pem&amp;quot; is to add the config:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOT_SIGNATURE_KEY_FILE=&amp;quot;{WORKSPACE}\\custom_key.pem&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Into 2 places:&lt;br /&gt;1. prj.conf of mcuboot child project&lt;br /&gt;2. prj.conf of application parent project&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please correct me if I am wrong&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&amp;nbsp;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/93315/steps-to-sign-binary-and-encode-the-signed-key-to-mcuboot/392823"]It uses a default private key[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393468?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 12:55:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e9563a5-4404-4f10-be11-689685770ccb</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/sigurd-hellesvik"&gt;Sigurd Hellesvik&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Now I am getting cryptography module not found error&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&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/pastedimage1667307363772v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, Please see that PIP and Python are present, as those commands say already installed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393454?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 12:27:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb3da528-adba-4a32-ad19-71a3cf612210</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Try to do &lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;python3 imgtool.py keygen -k filename.pem -t rsa-2048&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And if you still get the same error, it means that you are missing the click pip module. Try:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;pip3 install click&lt;/pre&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><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/393448?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 12:18:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a31e84e8-d53e-4f4b-847a-ead5f7eba8cb</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/sigurd-hellesvik"&gt;Sigurd Hellesvik&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am unable to understand here,&lt;/p&gt;
&lt;p&gt;Correct me if I am wrong on the flow of things below, I am using nCS on windows PC.&lt;br /&gt;&lt;br /&gt;First I go to the &amp;quot;nCS\bootloader\mcuboot\scripts&amp;quot; and invoke the command:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;imgtool.py keygen -k filename.pem -t rsa-2048&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am getting this error:&lt;/p&gt;
&lt;p&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/pastedimage1667305193703v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you help me here how to generate the key..?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: steps to sign binary and encode the signed key to mcuboot</title><link>https://devzone.nordicsemi.com/thread/392823?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 12:22:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f578a619-16aa-4ad7-ad25-04f91cd9d9b2</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When you build an image with MCUboot enabled in the nRF Connect SDK, the build system will do the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use a private key to generate a public key for the bootloader. It uses a default private key, but you should change this for production. See our docs on &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_fw_update.html#signature-keys"&gt;Signature Keys&lt;/a&gt;, and maybe also my unofficial&amp;nbsp;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key"&gt;MCUBoot Custom Key with SMP Server&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Automatically generate a signed binary to use for DFU called app_update.bin. See &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_build_system.html#mcuboot-output-build-files"&gt;MCUboot output build files&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So what you explain here is most likely done automatically for you.&lt;/p&gt;
&lt;p&gt;For more information on this, I have collected of my understandings of this at &lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures&lt;/a&gt;. &lt;br /&gt;Keep in mind that this git project is my personal one, and not official Nordic documentation.&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>