<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC Microcontrollersのトピックnxpkeygen Error: non-hexadecimal number found in fromhex</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/nxpkeygen-Error-non-hexadecimal-number-found-in-fromhex/m-p/1284166#M45215</link>
    <description>&lt;P&gt;Hello, I am trying to implement secure debug authentication as described in AN13037.&lt;/P&gt;&lt;P&gt;I have all my certificates in place but when I try to create the debug certificate (dc) I get the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(nxp_venv) ajf@ajf3:~/work/nxp/sdebug$ nxpkeygen gendc -c config.yml keys/dck_rsa_4096.dc
INFO:spsdk.apps.nxpkeygen:Loading configuration from yml file...
INFO:spsdk.apps.nxpkeygen:Creating RSA debug credential object...
GENERAL ERROR: ValueError: non-hexadecimal number found in fromhex() arg at position 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The config.yml file looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;socc: 0x0001
uuid: "0"
cc_socu: 0x03FF
cc_vu: 0x0000
cc_beacon: 0
rot_id: 0
rot_meta:
- keys/public_key0_4096.pub
- keys/public_key1_4096.pub
- keys/public_key2_4096.pub
- keys/public_key3_4096.pub
rotk: keys/ca_key0_4096.pem
dck: keys/dck_rsa_4096.pub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;(I added the rot_id not present in the example file as it errors without it. I have tried 1 and 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 4 ROT keys and I have tried rto_meta as 'pem' files and as hex dumps of the modulus. Likewise for the rotk&lt;/P&gt;&lt;P&gt;I have no idea where the error is originating. Running strace on nxpkeygen looks like it never seems to get as far as opening any of the key files anyway. I have also discovered that if I deliberately put invalid filenames for all the key files I get exactly the same error&lt;/P&gt;&lt;P&gt;The ROT certificates work fine for creating a secure signed binary code image using elftosb so I think they are all correct.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Fri, 28 May 2021 14:40:44 GMT</pubDate>
    <dc:creator>andrewfisher</dc:creator>
    <dc:date>2021-05-28T14:40:44Z</dc:date>
    <item>
      <title>nxpkeygen Error: non-hexadecimal number found in fromhex</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/nxpkeygen-Error-non-hexadecimal-number-found-in-fromhex/m-p/1284166#M45215</link>
      <description>&lt;P&gt;Hello, I am trying to implement secure debug authentication as described in AN13037.&lt;/P&gt;&lt;P&gt;I have all my certificates in place but when I try to create the debug certificate (dc) I get the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(nxp_venv) ajf@ajf3:~/work/nxp/sdebug$ nxpkeygen gendc -c config.yml keys/dck_rsa_4096.dc
INFO:spsdk.apps.nxpkeygen:Loading configuration from yml file...
INFO:spsdk.apps.nxpkeygen:Creating RSA debug credential object...
GENERAL ERROR: ValueError: non-hexadecimal number found in fromhex() arg at position 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The config.yml file looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;socc: 0x0001
uuid: "0"
cc_socu: 0x03FF
cc_vu: 0x0000
cc_beacon: 0
rot_id: 0
rot_meta:
- keys/public_key0_4096.pub
- keys/public_key1_4096.pub
- keys/public_key2_4096.pub
- keys/public_key3_4096.pub
rotk: keys/ca_key0_4096.pem
dck: keys/dck_rsa_4096.pub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;(I added the rot_id not present in the example file as it errors without it. I have tried 1 and 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 4 ROT keys and I have tried rto_meta as 'pem' files and as hex dumps of the modulus. Likewise for the rotk&lt;/P&gt;&lt;P&gt;I have no idea where the error is originating. Running strace on nxpkeygen looks like it never seems to get as far as opening any of the key files anyway. I have also discovered that if I deliberately put invalid filenames for all the key files I get exactly the same error&lt;/P&gt;&lt;P&gt;The ROT certificates work fine for creating a secure signed binary code image using elftosb so I think they are all correct.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 14:40:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/nxpkeygen-Error-non-hexadecimal-number-found-in-fromhex/m-p/1284166#M45215</guid>
      <dc:creator>andrewfisher</dc:creator>
      <dc:date>2021-05-28T14:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: nxpkeygen Error: non-hexadecimal number found in fromhex</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/nxpkeygen-Error-non-hexadecimal-number-found-in-fromhex/m-p/1284223#M45216</link>
      <description>&lt;P&gt;I think I have got to the bottom of this.&lt;/P&gt;&lt;P&gt;Inside the nxpkeygen program eventually we get to debug_credential.py and the lines around line 140&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        dc_obj = klass(
            socc=yaml_config['socc'], uuid=bytes.fromhex(yaml_config['uuid']),&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Elsewhere the uuid is going to need to be defined as a byte array of 4 bytes.&lt;/P&gt;&lt;P&gt;But if you enter the example config.yml file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;socc: 0x0001
uuid: "0"
cc_socu: 0x03FF
cc_vu: 0x0000
cc_beacon: 0
rot_meta:
- keys\rotk0_rsa_2048.pub
- keys\rotk1_rsa_2048.pub
- keys\rotk2_rsa_2048.pub
- keys\rotk3_rsa_2048.pub
rotk: keys\rotk0_rsa_2048.pem
dck: keys\dck_rsa_2048.pub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we see uuid defined as "0" thus bytes.fromhex() decodes this as a byte array containing one byte&lt;/P&gt;&lt;P&gt;The correct answer is uuid should be defined as "00000000" or better still the tool should be fixed!&lt;/P&gt;&lt;P&gt;It is also not expecting a leading 0x, unlike the other fields.&lt;/P&gt;&lt;P&gt;After this it became clear that the key files all need to be straight forward pem files.&lt;/P&gt;</description>
      <pubDate>Sun, 30 May 2021 17:52:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/nxpkeygen-Error-non-hexadecimal-number-found-in-fromhex/m-p/1284223#M45216</guid>
      <dc:creator>andrewfisher</dc:creator>
      <dc:date>2021-05-30T17:52:37Z</dc:date>
    </item>
  </channel>
</rss>

