<?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>How to validate SHA256 response from %CMNG=1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95969/how-to-validate-sha256-response-from-cmng-1</link><description>We are writing certificates to our device correctly and they are functioning. However, on the assembly line we can&amp;#39;t test the certificates right away. What I want to do is verify that the certs were written as expected before a device leaves the factory</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 26 Aug 2023 17:07:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95969/how-to-validate-sha256-response-from-cmng-1" /><item><title>RE: How to validate SHA256 response from %CMNG=1</title><link>https://devzone.nordicsemi.com/thread/443241?ContentTypeID=1</link><pubDate>Sat, 26 Aug 2023 17:07:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f089ef57-b8bc-4c07-904a-eeb66b335457</guid><dc:creator>chris_h</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;&amp;Oslash;yvind&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;Thanks for this post as it helped me tremendously, but the DigiCert link sent me in circles when my calculated SHA didn&amp;#39;t correspond with yours.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is because the DigiCert link corresponds with the DigiCertAssuredIDRootCA.crt.pem, not the DigiCertGlobalRootCA.crt.pem which is in your code snippet.&amp;nbsp; I&amp;#39;ve updated the link below which corresponds with your SHA&lt;/p&gt;
&lt;p&gt;Corrected link: &lt;a href="https://cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem"&gt;https://cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sha256sum DigiCertGlobalRootCA.crt.pem
39fdcf28aeffe08d03251fccaf645e3c5de19fa4ebbafc89b4ede2a422148bab DigiCertGlobalRootCA.crt.pem&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Appreciate your help on understanding this.&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate SHA256 response from %CMNG=1</title><link>https://devzone.nordicsemi.com/thread/406256?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 13:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:880fd739-af5e-4fe9-9d8c-d2c8a33aa32b</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Thanks for clarifying.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;One of my colleagues had a similar question, here is his answer:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The modem (and openssl for that matter) creates a checksum based on the input data, meaning that you&amp;#39;re calculating on a byte-by-byte, ie. the integrity of the file as a whole.&lt;/p&gt;
&lt;p&gt;If your line-endings are unix (\n), you&amp;#39;ll get one sha256sum, and if its windows style line-endings, you&amp;#39;ll get another one.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here&amp;#39;s my inputted Digicert Global RootCA at sec_tag=42:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/pastedimage1656407162952v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And here&amp;#39;s the pure &amp;quot;sha256sum&amp;quot; (alternative cmd: openssl sha256 &amp;lt;file&amp;gt;):&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;sha256sum DigiCertGlobalRootCA.crt.pem
39fdcf28aeffe08d03251fccaf645e3c5de19fa4ebbafc89b4ede2a422148bab DigiCertGlobalRootCA.crt.pem&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is the checksum of the unaltered file directly downloaded from DigiCert:&amp;nbsp;&lt;a href="https://cacerts.digicert.com/DigiCertAssuredIDRootCA.crt.pem"&gt;https://cacerts.digicert.com/DigiCertAssuredIDRootCA.crt.pem&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate SHA256 response from %CMNG=1</title><link>https://devzone.nordicsemi.com/thread/406219?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 12:03:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07b39004-b65f-4f21-8a61-afdf57b20f30</guid><dc:creator>ParasAtMotive</dc:creator><description>&lt;p&gt;Currently we are running the v1.3.2 and will be upgrading to 1.3.3 shortly.&amp;nbsp; We are currently using SDK version 2.0.2 and are in the process of upgrading it to 2.1.0.&lt;/p&gt;
&lt;p&gt;We have an AT client integrated in our application for debugging.&lt;/p&gt;
&lt;p&gt;As far as the SHA256 hash, I just took the Root CA that I wrote to the device, dumped out it&amp;#39;s contents:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cat RootCA.crt&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And copy pasted the output into &lt;a id="" href="https://emn178.github.io/online-tools/sha256.html"&gt;https://emn178.github.io/online-tools/sha256.html&lt;/a&gt; the contents are in PEM format.&lt;/p&gt;
&lt;p&gt;I then looked at the result and compared it to what I got from AT%CMNG.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;My main questions are: In the response from AT%CMNG=1 we get something that looks like a SHA256 digest for each slot in the security module.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is it a SHA256 digest?&lt;/li&gt;
&lt;li&gt;What is the input data for the digest?&amp;nbsp; (IE: Is it hashing the contents of the slot in PEM format, DER format, is any other data included?)&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate SHA256 response from %CMNG=1</title><link>https://devzone.nordicsemi.com/thread/406170?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 08:37:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e910ae92-ec47-48d7-b384-9b8589d8ed24</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What modem FW are you running on your device? From the output, that you have marked in yellow, it does look like you are using modem FW v1.3.2 or higher?&lt;/p&gt;
&lt;p&gt;Is this tested with the AT client sample or have integrated AT client in your application? If so, what version of nRF Connect SDK are you working on?&lt;/p&gt;
[quote user=""]I ran a SHA-256 digest on the Root CA in PEM format written to the device and the hash did not match the hash returned.[/quote]
&lt;p&gt;Can you provide more information on what you did in this step?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>