Hi @Uc_S ,
If you just need to rotate the keys back to the default, the nano-package example is the recommended simpler path — only the three scp03_* arrays (current keys for auth) and the three NEW_scp03_* arrays (default keys as target) need to be updated, and the revert call within ex_se05x_rotate_scp03_keys() needs to be commented out. Please refer to the following for details.
Change 1 — Set the current keys (used to open the SCP03 session)
Lines 38–43 are the auth keys passed to ex_set_scp03_keys(). Replace the placeholder 0xABCD... values with your current keys (0x4041...
uint8_t scp03_enc_key[AES_KEY_LEN_nBYTE] = {
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F };
uint8_t scp03_mac_key[AES_KEY_LEN_nBYTE] = {
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F };
uint8_t scp03_dek_key[AES_KEY_LEN_nBYTE] = {
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F };
Change 2 — Set the NEW target keys (the default SE051C A8FA keys)
Lines 45–50 are the keys that will be written into the SE051 via PutKey. Replace the 0x4041... placeholder with the SE051C OEF A8FA default values:
uint8_t NEW_scp03_enc_key[AES_KEY_LEN_nBYTE] = {
0xbf, 0xc2, 0xdb, 0xe1, 0x82, 0x8e, 0x03, 0x5d,
0x3e, 0x7f, 0xa3, 0x6b, 0x90, 0x2a, 0x05, 0xc6 };
uint8_t NEW_scp03_mac_key[AES_KEY_LEN_nBYTE] = {
0xbe, 0xf8, 0x5b, 0xd7, 0xba, 0x04, 0x97, 0xd6,
0x28, 0x78, 0x1c, 0xe4, 0x7b, 0x18, 0x8c, 0x96 };
uint8_t NEW_scp03_dek_key[AES_KEY_LEN_nBYTE] = {
0xd8, 0x73, 0xf3, 0x16, 0xbe, 0x29, 0x7f, 0x2f,
0xc9, 0xc0, 0xe4, 0x5f, 0x54, 0x71, 0x06, 0x99 };
Change 3 — Comment out the revert block
In ex_se05x_rotate_scp03_keys(), comment out lines 85–90 so the code does a single rotation only (current → default) and does not try to rotate back again:
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------