<?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>topic Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c? in Secure Authentication</title>
    <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412597#M2155</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259681"&gt;@Uc_S&lt;/a&gt;&amp;nbsp;，&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the detailed execution log — it provides exactly what is needed to pinpoint the issue. Your two suspects are both valid and well-reasoned. Here is a breakdown of what is most likely happening.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;What the 6A80 Error Tells Us&lt;/H2&gt;
&lt;P&gt;&lt;CODE&gt;SW 6A80&lt;/CODE&gt; (&lt;CODE&gt;SW_WRONG_DATA&lt;/CODE&gt;) means the SE051 rejected the data field of the PUT KEY APDU as cryptographically invalid. Since your log shows that authentication completed successfully (CardCryptogram verified + External Authenticate passed), the &lt;STRONG&gt;ENC and MAC keys are confirmed correct&lt;/STRONG&gt;. The failure is isolated specifically to the PUT KEY step, which points directly to an issue with the &lt;STRONG&gt;DEK key&lt;/STRONG&gt; or the &lt;STRONG&gt;AES encryption used to wrap the new key material&lt;/STRONG&gt;.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;Suspect 1: DEK Key Mismatch — Most Likely Primary Cause&lt;/H2&gt;
&lt;P&gt;Inside the PUT KEY command, each new key is encrypted under the current DEK before being sent to the SE. If the DEK value in the host code does not exactly match the DEK stored on the device, the SE decrypts garbage and returns 6A80.&lt;/P&gt;
&lt;P&gt;A near-identical case from a prior SE051C1 customer concluded:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;"If the minimal example works with PlatformSCP, then ENC and MAC keys are correct. As key rotation still fails, this means the DEK key needs to be wrong... the DEK key may have been set wrongly in the past."&lt;/EM&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is the most probable root cause given your history — a prior incomplete or incorrect rotation may have left the SE051's DEK in a state that no longer matches &lt;CODE&gt;0x4041...&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Confirmation step:&lt;/STRONG&gt; Test the same code on a &lt;STRONG&gt;brand-new, factory-fresh SE051 sample&lt;/STRONG&gt;. If it succeeds immediately, this confirms that the current device's DEK state is corrupted/unknown, and the chip should be replaced — there is no recovery path without the correct DEK.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;Suspect 2: OpenSSL 3.x Compatibility — Real Risk, Secondary Cause&lt;/H2&gt;
&lt;P&gt;The nano-package's SCP03 crypto path uses the legacy low-level OpenSSL API:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-c"&gt;AES_set_encrypt_key((uint8_t *)key, keylen * 8, &amp;amp;AESKey);
AES_ecb_encrypt(srcData, destData, &amp;amp;AESKey, AES_ENCRYPT);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The nano-package was designed and tested with &lt;STRONG&gt;OpenSSL 1.1.1 only&lt;/STRONG&gt;. In OpenSSL 3.x, these APIs are deprecated and require the legacy provider to be explicitly loaded at runtime. If it is not loaded, these calls can silently produce incorrect output — which would corrupt the DEK-encrypted payload and also trigger 6A80.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Recommended fix:&lt;/STRONG&gt; Switch the nano-package to use &lt;STRONG&gt;mbedTLS&lt;/STRONG&gt; as the host crypto backend (&lt;CODE&gt;-DEX_SE05X_USE_MBEDTLS=1&lt;/CODE&gt;), which does not rely on deprecated OpenSSL APIs and is fully supported for this use case. Alternatively, rebuild against OpenSSL 1.1.1 to test the OpenSSL version hypothesis in isolation.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;Recommended Action Sequence&lt;/H2&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Test on a fresh SE051 first&lt;/STRONG&gt; — this is the fastest way to confirm whether the current device's DEK is the root cause.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Switch to mbedTLS&lt;/STRONG&gt; for the host crypto backend to eliminate any OpenSSL 3.x risk going forward.&lt;/LI&gt;
&lt;LI&gt;If the fresh device also fails with mbedTLS, please share the build environment details (OS, compiler, mbedTLS version) for further investigation.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please note: if the current device's DEK is confirmed to be in an unknown state, there is &lt;STRONG&gt;no way to recover it&lt;/STRONG&gt; — a replacement chip with factory-default keys will be required.&lt;/P&gt;
&lt;P&gt;Please let us know the result of the fresh sample test and we will be happy to assist further.&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
    <pubDate>Thu, 10 Sep 2026 08:31:36 GMT</pubDate>
    <dc:creator>Kan_Li</dc:creator>
    <dc:date>2026-09-10T08:31:36Z</dc:date>
    <item>
      <title>How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411142#M2146</link>
      <description>&lt;P&gt;Hello NXP Community,&lt;/P&gt;&lt;P&gt;I am working with the SE051 secure element and would like to ask how to properly revert the Platform SCP03 keys back to their default values using the Plug and Trust Middleware.&lt;/P&gt;&lt;H4&gt;What I have done so far:&lt;/H4&gt;&lt;OL&gt;&lt;LI&gt;I modified demos/se05x/se05x_RotatePlatformSCP03Keys/se05x_TP_PlatformSCP03keys.c by commenting out the key reversion section (between doc:start:revert-scp03-keys and doc:end:revert-scp03-keys).&lt;/LI&gt;&lt;LI&gt;I built and executed the application on my setup.&lt;/LI&gt;&lt;LI&gt;The execution was successful, showing the message: "Congratulations !!! Key Rotation Successful!!!!"&lt;/LI&gt;&lt;LI&gt;To verify the key change, I updated /tmp/SE05X/plain_scp.txt with the new key value (0x4041... for ENC, MAC, and DEK) and successfully connected via ssscli connect.&lt;/LI&gt;&lt;LI&gt;Subsequent operations (ssscli generate rsa, ssscli set aes, and ssscli se05x readidlist) were all completed successfully, confirming that keys were written and IDs were retrieved without issues.&lt;/LI&gt;&lt;LI&gt;Now, I would like to restore the Platform SCP03 keys back to the default keys (defined in sss/ex/inc/ex_sss_tp_scp03_keys.h).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Could anyone guide me on how to modify se05x_TP_PlatformSCP03keys.c or what the correct process is to perform this key reversion?&lt;/P&gt;&lt;H4&gt;Environment:&lt;/H4&gt;&lt;UL&gt;&lt;LI&gt;Board: MCIMX8M-WEVK with OM-SE051ARD&lt;/LI&gt;&lt;LI&gt;Plug and Trust MW Version: v04.07.01&lt;/LI&gt;&lt;LI&gt;OP-TEE OS Version: 3.19.0&lt;/LI&gt;&lt;LI&gt;Linux Kernel: 6.1.151&lt;/LI&gt;&lt;LI&gt;OEF ID: A8FA&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any advice or code pointers would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2026 00:59:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411142#M2146</guid>
      <dc:creator>Uc_S</dc:creator>
      <dc:date>2026-09-04T00:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411210#M2147</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259681"&gt;@Uc_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;Rotating the Platform SCP03 keys back to the default values is only possible when the &lt;STRONG&gt;current keys are known&lt;/STRONG&gt;, as a successfully authenticated SCP03 session is required before any key update (&lt;CODE class="p8i6j0f"&gt;PutKey&lt;/CODE&gt;) command can be issued to the SE051.&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;If the current keys have been lost or forgotten, it is &lt;STRONG&gt;not possible&lt;/STRONG&gt; to authenticate to the SE051 and perform the key rotation. There is no backdoor or override mechanism — this is by design to preserve the security model of the device.&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;Additionally, a factory reset does &lt;STRONG&gt;not&lt;/STRONG&gt; help, as Platform SCP03 keys are explicitly unaffected by the factory reset procedure. &lt;A id="base-ui-:r4ho:" class="wdbi343 wdbi341 _1ibi0s3ec _1ibi0s376" tabindex="0" role="button" href="https://nxp1-my.sharepoint.com/personal/kan_li_nxp_com/Documents/data%20sheet/SE051/doc/SE051%20-%20User%20Guidelines(AN12730.pdf?web=1" rel="noreferrer" aria-expanded="false" aria-haspopup="dialog" data-base-ui-click-trigger="" data-label="1" aria-label="Citation 1" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;In this situation, the only option is to &lt;STRONG&gt;replace the SE051 with a new device&lt;/STRONG&gt; that still carries the default NXP-provisioned keys.&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2026 07:18:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411210#M2147</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2026-09-04T07:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411213#M2148</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/59276"&gt;@Kan_Li&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the clarification.&lt;/P&gt;&lt;P&gt;In my case, the current keys are known (0x4041... for ENC, MAC, and DEK), and I can successfully establish an SCP03 session using these keys via ssscli.&lt;/P&gt;&lt;P&gt;Since I have the current keys available to authenticate, could you please provide details on how to modify se05x_TP_PlatformSCP03keys.c to perform the key rotation back to the default values?&lt;/P&gt;&lt;P&gt;Specifically, I would like to know:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Which variables or macros should be updated with the current keys (0x4041...) for authentication during session setup.&lt;/LI&gt;&lt;LI&gt;Which variables or structures should hold the target default key values (ex_sss_tp_scp03_keys.h) for the PutKey operation.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any code snippets or specific line references in se05x_TP_PlatformSCP03keys.c (or related boot/auth headers) would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2026 07:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411213#M2148</guid>
      <dc:creator>Uc_S</dc:creator>
      <dc:date>2026-09-04T07:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411228#M2150</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259681"&gt;@Uc_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;If you just need to rotate the keys back to the default,&amp;nbsp;the nano-package example is the &lt;STRONG&gt;recommended simpler path&lt;/STRONG&gt; — only the three &lt;CODE class="p8i6j0f"&gt;scp03_*&lt;/CODE&gt; arrays (current keys for auth) and the three &lt;CODE class="p8i6j0f"&gt;NEW_scp03_*&lt;/CODE&gt; arrays (default keys as target) need to be updated, and the revert call within&amp;nbsp;ex_se05x_rotate_scp03_keys() needs to be commented out. Please refer to the following for details.&lt;/P&gt;
&lt;H3 class="_9k2iva0 p8i6j0c _1ibi0s314 heading3 _9k2iva1"&gt;Change 1 — Set the current keys (used to open the SCP03 session)&lt;/H3&gt;
&lt;P class="p8i6j01 paragraph"&gt;Lines 38–43 are the auth keys passed to &lt;CODE class="p8i6j0f"&gt;ex_set_scp03_keys()&lt;/CODE&gt;. Replace the placeholder &lt;CODE class="p8i6j0f"&gt;0xABCD...&lt;/CODE&gt; values with your &lt;STRONG&gt;current keys&lt;/STRONG&gt; (&lt;CODE class="p8i6j0f"&gt;0x4041...&lt;/CODE&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt; &lt;A id="base-ui-:r4q5:" class="wdbi343 wdbi341 _1ibi0s3ec _1ibi0s376" tabindex="0" role="button" href="https://raw.githubusercontent.com/NXPPlugNTrust/nano-package/master/examples/se05x_rotate_scp03_keys/src/ex_se05x_rotate_scp03_keys.c" rel="noreferrer" aria-expanded="false" aria-haspopup="dialog" data-base-ui-click-trigger="" data-label="2" aria-label="Citation 2" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3en" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-c p8i6j0e hljs language-c _12n1b832"&gt;&lt;SPAN class="hljs-type"&gt;uint8_t&lt;/SPAN&gt; scp03_enc_key[AES_KEY_LEN_nBYTE] = {
    &lt;SPAN class="hljs-number"&gt;0x40&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x41&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x42&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x43&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x44&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x45&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x46&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x47&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-number"&gt;0x48&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x49&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4A&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4B&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4C&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4D&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4E&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4F&lt;/SPAN&gt; };

&lt;SPAN class="hljs-type"&gt;uint8_t&lt;/SPAN&gt; scp03_mac_key[AES_KEY_LEN_nBYTE] = {
    &lt;SPAN class="hljs-number"&gt;0x40&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x41&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x42&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x43&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x44&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x45&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x46&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x47&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-number"&gt;0x48&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x49&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4A&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4B&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4C&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4D&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4E&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4F&lt;/SPAN&gt; };

&lt;SPAN class="hljs-type"&gt;uint8_t&lt;/SPAN&gt; scp03_dek_key[AES_KEY_LEN_nBYTE] = {
    &lt;SPAN class="hljs-number"&gt;0x40&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x41&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x42&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x43&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x44&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x45&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x46&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x47&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-number"&gt;0x48&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x49&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4A&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4B&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4C&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4D&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4E&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x4F&lt;/SPAN&gt; };
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3dp _1ibi0s332 _1ibi0s3eo _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="l8rrz25 _1ibi0s3eb"&gt;c&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;H3 class="_9k2iva0 p8i6j0c _1ibi0s314 heading3 _9k2iva1"&gt;Change 2 — Set the NEW target keys (the default SE051C A8FA keys)&lt;/H3&gt;
&lt;P class="p8i6j01 paragraph"&gt;Lines 45–50 are the keys that will be &lt;STRONG&gt;written into the SE051&lt;/STRONG&gt; via &lt;CODE class="p8i6j0f"&gt;PutKey&lt;/CODE&gt;. Replace the &lt;CODE class="p8i6j0f"&gt;0x4041...&lt;/CODE&gt; placeholder with the SE051C OEF A8FA default values: &lt;A id="base-ui-:r4qa:" class="wdbi343 wdbi341 _1ibi0s3ec _1ibi0s376" tabindex="0" role="button" href="https://raw.githubusercontent.com/NXPPlugNTrust/nano-package/master/examples/se05x_rotate_scp03_keys/src/ex_se05x_rotate_scp03_keys.c" rel="noreferrer" aria-expanded="false" aria-haspopup="dialog" data-base-ui-click-trigger="" data-label="2" aria-label="Citation 2" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3en" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-c p8i6j0e hljs language-c _12n1b832"&gt;&lt;SPAN class="hljs-type"&gt;uint8_t&lt;/SPAN&gt; NEW_scp03_enc_key[AES_KEY_LEN_nBYTE] = {
    &lt;SPAN class="hljs-number"&gt;0xbf&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xc2&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xdb&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xe1&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x82&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x8e&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x03&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x5d&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-number"&gt;0x3e&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x7f&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xa3&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x6b&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x90&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x2a&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x05&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xc6&lt;/SPAN&gt; };

&lt;SPAN class="hljs-type"&gt;uint8_t&lt;/SPAN&gt; NEW_scp03_mac_key[AES_KEY_LEN_nBYTE] = {
    &lt;SPAN class="hljs-number"&gt;0xbe&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xf8&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x5b&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xd7&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xba&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x04&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x97&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xd6&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-number"&gt;0x28&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x78&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x1c&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xe4&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x7b&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x18&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x8c&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x96&lt;/SPAN&gt; };

&lt;SPAN class="hljs-type"&gt;uint8_t&lt;/SPAN&gt; NEW_scp03_dek_key[AES_KEY_LEN_nBYTE] = {
    &lt;SPAN class="hljs-number"&gt;0xd8&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x73&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xf3&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x16&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xbe&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x29&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x7f&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x2f&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-number"&gt;0xc9&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xc0&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0xe4&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x5f&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x54&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x71&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x06&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0x99&lt;/SPAN&gt; };
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3dp _1ibi0s332 _1ibi0s3eo _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="l8rrz25 _1ibi0s3eb"&gt;c&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;H3 class="_9k2iva0 p8i6j0c _1ibi0s314 heading3 _9k2iva1"&gt;Change 3 — Comment out the revert block&lt;/H3&gt;
&lt;P class="p8i6j01 paragraph"&gt;In &lt;CODE class="p8i6j0f"&gt;ex_se05x_rotate_scp03_keys()&lt;/CODE&gt;, comment out lines 85–90 so the code does a &lt;STRONG&gt;single rotation only&lt;/STRONG&gt; (current → default) and does not try to rotate back again: &lt;A id="base-ui-:r4qf:" class="wdbi343 wdbi341 _1ibi0s3ec _1ibi0s376" tabindex="0" role="button" href="https://raw.githubusercontent.com/NXPPlugNTrust/nano-package/master/examples/se05x_rotate_scp03_keys/src/ex_se05x_rotate_scp03_keys.c" rel="noreferrer" aria-expanded="false" aria-haspopup="dialog" data-base-ui-click-trigger="" data-label="2" aria-label="Citation 2" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3en" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-c p8i6j0e hljs language-c _12n1b832"&gt;&lt;SPAN class="hljs-comment"&gt;/* -- Comment out the revert block below -- */&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;// SMLOG_I("Reverting SCP03 keys(version - %02x) to OLD KEYS \n", KEY_VERSION);&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;// ret = ex_se05x_change_keys(&amp;amp;se05x_session, &amp;amp;scp03_enc_key[0], &amp;amp;scp03_mac_key[0], &amp;amp;scp03_dek_key[0]);&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;// if (ret != 0) {&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;//     SMLOG_E("Error in ex_se05x_change_keys \n");&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;//     return 1;&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;// }&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3dp _1ibi0s332 _1ibi0s3eo _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="l8rrz25 _1ibi0s3eb"&gt;c&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;H2 class="_9k2iva0 p8i6j0c _1ibi0s314 heading2 _9k2iva1"&gt;&amp;nbsp;&lt;/H2&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2026 08:24:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2411228#M2150</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2026-09-04T08:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412191#M2154</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/59276"&gt;@Kan_Li&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for providing the detailed guidance.&lt;/P&gt;&lt;P&gt;Following your instructions, I updated the keys, commented out the revert block, and successfully built and executed the nano-package example.&lt;/P&gt;&lt;P&gt;However, during execution, the SCP03 key update operation failed with a SW status code 6A80 during the PUT KEY APDU command. Here is the summary of the execution log:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Plug and Trust nano package - version: 1.6.1
...
Establish Secure Channel to SE05x !
Sending GP Initialize Update Command !!!
...
CardCryptogram verified successfully...Calculate HostCryptogram
Sending GP External Authenticate Command !!!
APDU Tx&amp;gt; :84 82 33 00 10 ...
APDU Rx&amp;lt; :69 82
Authentication Successful!!!

Created scp03 Session
Changing SCP03 keys(version - 0b) to NEW KEYS
APDU Tx&amp;gt; :84 d8 0b 81 58 ...
APDU Rx&amp;lt; :6a 80
Error in DoAPDUTxRx
Error in ex_se05x_change_keys
SE05x Rotate SCP03 keys Example Failed !&lt;/LI-CODE&gt;&lt;P&gt;Regarding potential root causes, I suspect that either the OpenSSL version (OpenSSL 3.x is used on both the build PC and the target evaluation board) is affecting key derivation/formatting during PutKey, or the DEK value in particular might have been mismatched/rewritten previously.&lt;/P&gt;&lt;P&gt;At this moment, I do not have sufficient bandwidth to investigate or address these possibilities further. I will look into them separately if time permits later.&lt;/P&gt;&lt;P&gt;Thank you again for your assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2026 01:53:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412191#M2154</guid>
      <dc:creator>Uc_S</dc:creator>
      <dc:date>2026-09-09T01:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412597#M2155</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259681"&gt;@Uc_S&lt;/a&gt;&amp;nbsp;，&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the detailed execution log — it provides exactly what is needed to pinpoint the issue. Your two suspects are both valid and well-reasoned. Here is a breakdown of what is most likely happening.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;What the 6A80 Error Tells Us&lt;/H2&gt;
&lt;P&gt;&lt;CODE&gt;SW 6A80&lt;/CODE&gt; (&lt;CODE&gt;SW_WRONG_DATA&lt;/CODE&gt;) means the SE051 rejected the data field of the PUT KEY APDU as cryptographically invalid. Since your log shows that authentication completed successfully (CardCryptogram verified + External Authenticate passed), the &lt;STRONG&gt;ENC and MAC keys are confirmed correct&lt;/STRONG&gt;. The failure is isolated specifically to the PUT KEY step, which points directly to an issue with the &lt;STRONG&gt;DEK key&lt;/STRONG&gt; or the &lt;STRONG&gt;AES encryption used to wrap the new key material&lt;/STRONG&gt;.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;Suspect 1: DEK Key Mismatch — Most Likely Primary Cause&lt;/H2&gt;
&lt;P&gt;Inside the PUT KEY command, each new key is encrypted under the current DEK before being sent to the SE. If the DEK value in the host code does not exactly match the DEK stored on the device, the SE decrypts garbage and returns 6A80.&lt;/P&gt;
&lt;P&gt;A near-identical case from a prior SE051C1 customer concluded:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;"If the minimal example works with PlatformSCP, then ENC and MAC keys are correct. As key rotation still fails, this means the DEK key needs to be wrong... the DEK key may have been set wrongly in the past."&lt;/EM&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is the most probable root cause given your history — a prior incomplete or incorrect rotation may have left the SE051's DEK in a state that no longer matches &lt;CODE&gt;0x4041...&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Confirmation step:&lt;/STRONG&gt; Test the same code on a &lt;STRONG&gt;brand-new, factory-fresh SE051 sample&lt;/STRONG&gt;. If it succeeds immediately, this confirms that the current device's DEK state is corrupted/unknown, and the chip should be replaced — there is no recovery path without the correct DEK.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;Suspect 2: OpenSSL 3.x Compatibility — Real Risk, Secondary Cause&lt;/H2&gt;
&lt;P&gt;The nano-package's SCP03 crypto path uses the legacy low-level OpenSSL API:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-c"&gt;AES_set_encrypt_key((uint8_t *)key, keylen * 8, &amp;amp;AESKey);
AES_ecb_encrypt(srcData, destData, &amp;amp;AESKey, AES_ENCRYPT);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The nano-package was designed and tested with &lt;STRONG&gt;OpenSSL 1.1.1 only&lt;/STRONG&gt;. In OpenSSL 3.x, these APIs are deprecated and require the legacy provider to be explicitly loaded at runtime. If it is not loaded, these calls can silently produce incorrect output — which would corrupt the DEK-encrypted payload and also trigger 6A80.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Recommended fix:&lt;/STRONG&gt; Switch the nano-package to use &lt;STRONG&gt;mbedTLS&lt;/STRONG&gt; as the host crypto backend (&lt;CODE&gt;-DEX_SE05X_USE_MBEDTLS=1&lt;/CODE&gt;), which does not rely on deprecated OpenSSL APIs and is fully supported for this use case. Alternatively, rebuild against OpenSSL 1.1.1 to test the OpenSSL version hypothesis in isolation.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2&gt;Recommended Action Sequence&lt;/H2&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Test on a fresh SE051 first&lt;/STRONG&gt; — this is the fastest way to confirm whether the current device's DEK is the root cause.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Switch to mbedTLS&lt;/STRONG&gt; for the host crypto backend to eliminate any OpenSSL 3.x risk going forward.&lt;/LI&gt;
&lt;LI&gt;If the fresh device also fails with mbedTLS, please share the build environment details (OS, compiler, mbedTLS version) for further investigation.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please note: if the current device's DEK is confirmed to be in an unknown state, there is &lt;STRONG&gt;no way to recover it&lt;/STRONG&gt; — a replacement chip with factory-default keys will be required.&lt;/P&gt;
&lt;P&gt;Please let us know the result of the fresh sample test and we will be happy to assist further.&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2026 08:31:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412597#M2155</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2026-09-10T08:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to revert Platform SCP03 keys back to default using se05x_TP_PlatformSCP03keys.c?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412885#M2156</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/59276"&gt;@Kan_Li&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the detailed explanation and analysis regarding the 6A80 error.&lt;/P&gt;&lt;P&gt;The breakdown of the DEK key mismatch and the OpenSSL 3.x compatibility risks (along with the suggestion to use mbedTLS) is helpful and clarifies the exact mechanisms at play.&lt;/P&gt;&lt;P&gt;I will keep these suggested options -- such as testing on a fresh sample and considering mbedTLS for the crypto backend -- in mind for future troubleshooting when resources and bandwidth allow.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2026 03:58:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/How-to-revert-Platform-SCP03-keys-back-to-default-using-se05x-TP/m-p/2412885#M2156</guid>
      <dc:creator>Uc_S</dc:creator>
      <dc:date>2026-09-11T03:58:32Z</dc:date>
    </item>
  </channel>
</rss>

