[SE050E] question for Se05x_API_GetFreeMemory and ex_se05x_ReadIDList

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[SE050E] question for Se05x_API_GetFreeMemory and ex_se05x_ReadIDList

2,041件の閲覧回数
kennychiu
Contributor I

Hi

I am using the OM‑SE050ARD‑E development board and  https://github.com/NXPPlugNTrust/nano-package.

Se05x_API_GetFreeMemoryfrom SE-PLUG-TRUST-MW_04.07.00

1. I called Se05x_API_GetFreeMemory() and obtained the following memory data.

kSE05x_MemoryType_PERSISTENT get 616
kSE05x_MemoryType_TRANSIENT_RESET 796
kSE05x_MemoryType_TRANSIENT_DESELECT 784

Is this normal? The free memory seems rather low—could you please let me know approximately how much memory the SE050E provides by default?

2. Since I’ve forgotten which keys I previously set, I tried to use ex_se05x_ReadIDList() to read the list of key IDs, but it always fails with error codes 69 85.
a. SCP03 is enabled, and I have updated the ENC and MAC keys according to AN12436.
b. ex_se05x_GetInfo() runs successfully, so the SCP03 setup should be correct.

 

Thanks

 

ex_se05x_ReadIDList

I: Plug and Trust nano package - version: 1.5.4

APDU Tx>
00 a4 04 00 10 a0 00 00 |........
03 96 54 53 00 00 00 01 |..TS....
03 00 00 00 00 00 |......
APDU Rx<
07 02 00 3f 9f ff ff 90 |...?....
00 |.
I: Establish Secure Channel to SE05x !

hostChallenge ==>
11 22 33 44 55 66 77 88 |."3DUfw.
Sending GP Initialize Update Command !!!

APDU Tx>
80 50 0b 00 08 11 22 33 |.P...."3
44 55 66 77 88 |DUfw.
APDU Rx<
90 03 13 47 00 00 43 20 |...G..C
23 16 0b 03 00 05 43 7d |#.....C}
4e 3c 21 3d 20 c4 d8 89 |N<!= ...
c1 27 02 64 c4 90 00 |.'.d...
Output: keyDivData
90 03 13 47 00 00 43 20 |...G..C
23 16 |#.
Output: keyInfo
0b 03 00 |...
Output: cardChallenge
05 43 7d 4e 3c 21 3d 20 |.C}N<!=
Output: cardCryptoGram
c4 d8 89 c1 27 02 64 c4 |....'.d.
Set the Derviation data to generate Session ENC key

Output:scp03_session_enc_Key ==>
01 2c 3f cd b3 4f 6c ff |.,?..Ol.
7e 34 4d 07 5b d0 48 cb |~4M.[.H.
Set the Derviation data to generate Session MAC key

Output:scp03_session_mac_Key ==>
5c ae 32 de a3 a3 61 5e |\.2...a^
2a ae 30 8d 74 22 77 e0 |*.0.t"w.
Set the Derviation data to generate Session RMAC key

Output:scp03_session_rmac_Key ==>
5f bb b8 83 f3 6e 0f 2c |_....n.,
43 58 13 08 83 c7 d4 71 |CX.....q
Output:cardCryptogram ==>
c4 d8 89 c1 27 02 64 c4 |....'.d.
b1 7a db 0a ce a0 ec 5f |.z....._
cardCryptoGram ==>
c4 d8 89 c1 27 02 64 c4 |....'.d.
CardCryptogram verified successfully...Calculate HostCryptogram

Output:hostCryptogram ==>
f0 0f 60 91 b6 f1 fd ee |..`.....
05 af 41 11 75 a2 f6 b5 |..A.u...
hostCryptogram ==>
f0 0f 60 91 b6 f1 fd ee |..`.....
Output: Calculated MAC ==>
bc d1 9e 29 c7 83 89 2d |...)...-
16 28 09 3a b9 e3 b6 4e |.(.:...N
Add calculated MAC Value to cmd Data
Sending GP External Authenticate Command !!!
APDU Tx>
84 82 33 00 10 f0 0f 60 |..3....`
91 b6 f1 fd ee bc d1 9e |........
29 c7 83 89 2d |)...-
APDU Rx<
90 00 |..
Authentication Successful!!!

I: Created scp03 Session

APDU - Se05x_API_ReadIDList []

APDU :DEBUG:kSE05x_TAG_1["output offset"] = 0x0

APDU :DEBUG:kSE05x_TAG_2["filter"] = 0xFF

SCP03: Encrypted Data ==>
84 02 00 25 18 30 34 24 |...%.04$
cf 3a df b5 5a 45 cb e5 |.:..ZE..
f9 87 4d 53 a1 0e 8f 9f |..MS....
7a 36 e8 84 c8 |z6...
APDU Tx>
84 02 00 25 18 30 34 24 |...%.04$
cf 3a df b5 5a 45 cb e5 |.:..ZE..
f9 87 4d 53 a1 0e 8f 9f |..MS....
7a 36 e8 84 c8 |z6...
APDU Rx<
69 85 |i.
E: Error in Se05x_API_ReadIDList

 

ex_se05x_GetInfo()

I: Plug and Trust nano package - version: 1.5.4

APDU Tx>
00 a4 04 00 0b d2 76 00 |......v.
00 85 30 4a 43 4f 90 03 |..0JCO..
00 |.
APDU Rx<
6f 13 84 0b d2 76 00 00 |o....v..
85 30 4a 43 4f 90 03 a5 |.0JCO...
04 9f 65 01 ff 90 00 |..e....
I: Establish Secure Channel to SE05x !

hostChallenge ==>
11 22 33 44 55 66 77 88 |."3DUfw.
Sending GP Initialize Update Command !!!

APDU Tx>
80 50 0b 00 08 11 22 33 |.P...."3
44 55 66 77 88 |DUfw.
APDU Rx<
90 03 13 47 00 00 43 20 |...G..C
23 16 0b 03 00 27 fc 81 |#....'..
6b 41 63 1e c9 e1 60 44 |kAc...`D
5c ec 7a e2 a3 90 00 |\.z....
Output: keyDivData
90 03 13 47 00 00 43 20 |...G..C
23 16 |#.
Output: keyInfo
0b 03 00 |...
Output: cardChallenge
27 fc 81 6b 41 63 1e c9 |'..kAc..
Output: cardCryptoGram
e1 60 44 5c ec 7a e2 a3 |.`D\.z..
Set the Derviation data to generate Session ENC key

Output:scp03_session_enc_Key ==>
6d da 65 67 04 5d 16 c3 |m.eg.]..
98 a8 c5 38 fb b3 38 4f |...8..8O
Set the Derviation data to generate Session MAC key

Output:scp03_session_mac_Key ==>
19 b3 ac 95 02 2f 09 86 |...../..
29 ff 36 9b 1b 74 a5 34 |).6..t.4
Set the Derviation data to generate Session RMAC key

Output:scp03_session_rmac_Key ==>
c7 d4 9a d2 8b d1 b5 6b |.......k
89 92 20 ac 07 ab 16 f1 |.. .....
Output:cardCryptogram ==>
e1 60 44 5c ec 7a e2 a3 |.`D\.z..
bf 39 c3 38 44 2f cc 7f |.9.8D/..
cardCryptoGram ==>
e1 60 44 5c ec 7a e2 a3 |.`D\.z..
CardCryptogram verified successfully...Calculate HostCryptogram

Output:hostCryptogram ==>
50 39 0d fd ad cb f2 04 |P9......
0c b5 26 7d e4 99 52 30 |..&}..R0
hostCryptogram ==>
50 39 0d fd ad cb f2 04 |P9......
Output: Calculated MAC ==>
ad 14 d0 c1 36 cd cb 40 |....6..@
6b 8d e8 3b 75 70 b2 f7 |k..;up..
Add calculated MAC Value to cmd Data
Sending GP External Authenticate Command !!!
APDU Tx>
84 82 33 00 10 50 39 0d |..3..P9.
fd ad cb f2 04 ad 14 d0 |........
c1 36 cd cb 40 |.6..@

APDU Rx<
90 00 |..
Authentication Successful!!!

I: Created scp03 Session

APDU Tx>
00 a4 04 00 10 a0 00 00 |........
03 96 54 53 00 00 00 01 |..TS....
03 30 00 00 00 00 |.0....
APDU Rx<
6a 82 |j.
W: No SemsLite Applet Available.

APDU - Se05x_API_SessionClose []

I: Plug and Trust nano package - version: 1.5.4

APDU Tx>
00 a4 04 00 10 a0 00 00 |........
03 96 54 53 00 00 00 01 |..TS....
03 00 00 00 00 00 |......
APDU Rx<
07 02 00 3f 9f ff ff 90 |...?....
00 |.
I: Establish Secure Channel to SE05x !

hostChallenge ==>
11 22 33 44 55 66 77 88 |."3DUfw.
Sending GP Initialize Update Command !!!

APDU Tx>
80 50 0b 00 08 11 22 33 |.P...."3
44 55 66 77 88 |DUfw.
APDU Rx<
90 03 13 47 00 00 43 20 |...G..C
23 16 0b 03 00 0b 2e 61 |#......a
d3 d4 f3 11 f4 85 d3 e5 |........
8c 6d 1a 91 c9 90 00 |.m.....
Output: keyDivData
90 03 13 47 00 00 43 20 |...G..C
23 16 |#.
Output: keyInfo
0b 03 00 |...
Output: cardChallenge
0b 2e 61 d3 d4 f3 11 f4 |..a.....
Output: cardCryptoGram
85 d3 e5 8c 6d 1a 91 c9 |....m...
Set the Derviation data to generate Session ENC key

Output:scp03_session_enc_Key ==>
22 bc 3b 23 72 d7 8d f6 |".;#r...
47 60 1d 60 92 46 dc 89 |G`.`.F..
Set the Derviation data to generate Session MAC key

Output:scp03_session_mac_Key ==>
83 68 f7 10 b3 92 d1 82 |.h......
be 3c 76 d8 69 da fe 7a |.<v.i..z
Set the Derviation data to generate Session RMAC key

Output:scp03_session_rmac_Key ==>
9a ec 4e 1c a0 3a f6 17 |..N..:..
d8 a1 88 58 49 da 35 6b |...XI.5k
Output:cardCryptogram ==>
85 d3 e5 8c 6d 1a 91 c9 |....m...
e5 22 b2 ca 08 e4 1b c7 |."......
cardCryptoGram ==>
85 d3 e5 8c 6d 1a 91 c9 |....m...
CardCryptogram verified successfully...Calculate HostCryptogram

Output:hostCryptogram ==>
94 c9 8c 24 22 64 e3 21 |...$"d.!
b0 50 c3 19 25 e7 82 f5 |.P..%...
hostCryptogram ==>
94 c9 8c 24 22 64 e3 21 |...$"d.!
Output: Calculated MAC ==>
17 6f cc 1d 37 59 87 36 |.o..7Y.6
f7 66 26 97 d1 dc b4 60 |.f&....`
Add calculated MAC Value to cmd Data
Sending GP External Authenticate Command !!!
APDU Tx>
84 82 33 00 10 94 c9 8c |..3.....
24 22 64 e3 21 17 6f cc |$"d.!.o.
1d 37 59 87 36 |.7Y.6
APDU Rx<
90 00 |..
Authentication Successful!!!

I: Created scp03 Session

APDU - CheckObjectExists []

APDU :DEBUG:kSE05x_TAG_1["object id"] = 0x7FFF0206

SCP03: Encrypted Data ==>
84 04 00 27 18 ca eb 81 |...'....
92 76 1d 78 d4 d1 5b b1 |.v.x..[.
69 87 2a 05 8c d7 78 19 |i.*...x.
aa 4e 06 43 64 |.N.Cd
APDU Tx>
84 04 00 27 18 ca eb 81 |...'....
92 76 1d 78 d4 d1 5b b1 |.v.x..[.
69 87 2a 05 8c d7 78 19 |i.*...x.
aa 4e 06 43 64 |.N.Cd
APDU Rx<
f1 a9 ae ff fa c8 c3 7e |.......~
08 05 47 f9 a3 62 56 28 |..G..bV(
bc 2f 1a 36 77 dc c3 fe |./.6w...
90 00 |..
SCP03: RMAC verified successfully...Decrypt Response Data

SCP03: Decrypted Data ==>
41 01 01 90 00 |A....
APDU - ReadObject []

APDU :DEBUG:kSE05x_TAG_1["object id"] = 0x7FFF0206

APDU :DEBUG:kSE05x_TAG_2["offset"] = 0x0

APDU :DEBUG:kSE05x_TAG_3["length"] = 0x12

SCP03: Encrypted Data ==>
84 02 00 00 00 00 18 9e |........
84 55 05 58 c3 7a 9e 37 |.U.X.z.7
ba 9a 51 a3 6d d6 41 52 |..Q.m.AR
37 b3 44 a0 81 a5 e1 00 |7.D.....
00 |.
APDU Tx>
84 02 00 00 00 00 18 9e |........
84 55 05 58 c3 7a 9e 37 |.U.X.z.7
ba 9a 51 a3 6d d6 41 52 |..Q.m.AR
37 b3 44 a0 81 a5 e1 00 |7.D.....
00 |.
APDU Rx<
b6 66 54 5a f9 2a 21 ab |.fTZ.*!.
fb cd 3e 41 e5 aa 06 12 |..>A....
c4 57 eb 78 9c 1a 5c 09 |.W.x..\.
fb 03 81 80 51 c4 4d a2 |....Q.M.
46 83 45 5c d3 50 66 f1 |F.E\.Pf.
90 00 |..
SCP03: RMAC verified successfully...Decrypt Response Data

SCP03: Decrypted Data ==>
41 82 00 12 04 00 50 01 |A.....P.
05 da 80 0f 3a c4 35 04 |....:.5.
2a 00 b2 59 10 90 90 00 |*..Y....
W: #####################################################

uid
04 00 50 01 05 da 80 0f |..P.....
3a c4 35 04 2a 00 b2 59 |:.5.*..Y
10 90 |..
APDU - GetVersion []

SCP03: Encrypted Data ==>
84 04 00 20 08 9d 01 1e |... ....
25 63 8a c1 f4 |%c...
APDU Tx>
84 04 00 20 08 9d 01 1e |... ....
25 63 8a c1 f4 |%c...
APDU Rx<
ae fe 5f 01 b8 d2 9f fd |.._.....
1b f8 f8 80 a6 cd 28 98 |......(.
7b 58 ea 3b 18 6c 2c 81 |{X.;.l,.
90 00 |..
SCP03: RMAC verified successfully...Decrypt Response Data

SCP03: Decrypted Data ==>
41 82 00 07 07 02 00 3f |A......?
9f ff ff 90 00 |.....
W: #####################################################

I: Applet Major = 7

I: Applet Minor = 2

I: Applet patch = 0

I: AppletConfig = 3F9F

I: With ECDSA_ECDH_ECDHE
I:

I: With EDDSA
I:

I: With DH_MONT
I:

I: With HMAC
I:

I: WithOut RSA_PLAIN
I:

I: WithOut RSA_CRT
I:

I: With AES
I:

I: With DES
I:

I: With PBKDF
I:

I: With TLS
I:

I: With MIFARE
I:

I: With I2CM
I:

APDU Tx>
00 a4 04 00 00 |.....
APDU Rx<
6f 10 84 08 a0 00 00 01 |o.......
51 00 00 00 a5 04 9f 65 |Q......e
01 ff 90 00 |....
APDU Tx>
80 ca 00 fe 02 df 28 00 |......(.
APDU Rx<
fe 45 df 28 42 01 0c 00 |.E.(B...
01 a9 21 89 0a 6f 56 4a |..!..oVJ
23 9c 41 02 08 00 00 00 |#.A.....
00 00 00 00 01 03 18 4a |.......J
33 52 33 35 31 30 32 39 |3R351029
42 34 31 31 31 30 30 1a |B411100.
08 fa 50 67 b5 f2 56 05 |..Pg..V.
01 00 07 01 00 08 08 2e |........
5a d8 84 09 c9 ba db 90 |Z.......
00 |.
W: #####################################################

I: Tag value - proprietary data 0xFE = 0xFE

I: Length of following data 0x45 = 0x45

Tag card identification data
df 28 |.(
I: Length of card identification data = 0x42

I: Tag configuration ID (Must be 0x01) = 0x01

Length configuration ID 0x0C = 0x0C

Configuration ID
00 01 a9 21 89 0a 6f 56 |...!..oV
4a 23 9c 41 |J#.A
I: OEF ID = 0xA9 0x21

I: Tag patch ID (Must be 0x02) = 0x02

Length patch ID 0x08 = 0x08

Patch ID
00 00 00 00 00 00 00 01 |........
I: Tag platform build ID1 (Must be 0x03) = 0x03

Length platform build ID 0x18 = 0x18

Platform build ID
4a 33 52 33 35 31 30 32 |J3R35102
39 42 34 31 31 31 30 30 |9B411100
1a 08 fa 50 67 b5 f2 56 |...Pg..V
I: JCOP Platform ID = J3R351029B411100

I: Tag FIPS mode (Must be 0x05) = 0x05

Length FIPS mode 0x01 = 0x01

I: FIPS mode var = 0x00

I: Tag pre-perso state (Must be 0x07) = 0x07

Length pre-perso state 0x01 = 0x01

I: Bit mask of pre-perso state var = 0x00

I: Tag ROM ID (Must be 0x08) = 0x08

Length ROM ID 0x08 = 0x08

ROM ID
2e 5a d8 84 09 c9 ba db |.Z......
Status Word (SW)
90 00 |..
I: se05x_GetInfoPlainApplet Example Success !!!...

APDU Tx>
80 ca 9f 7f 00 |.....
APDU Rx<
9f 7f 2a 47 90 d3 21 47 |..*G..!G
00 00 00 00 00 13 47 00 |......G.
00 43 20 23 16 00 00 00 |.C #....
00 00 00 00 00 01 2a 00 |......*.
30 30 30 34 33 00 00 00 |00043...
00 00 00 00 00 90 00 |.......
W: #####################################################

cplc_data IC_fabricator
47 90 |G.
cplc_data IC_type1
d3 21 |.!
cplc_data Operating_system_identifier
47 00 |G.
cplc_data Operating_system_release_date
00 00 |..
cplc_data Operating_system_release_level
00 00 |..
cplc_data IC_fabrication_date
13 47 |.G
cplc_data IC_Serial_number
00 00 43 20 |..C
cplc_data IC_Batch_identifier
23 16 |#.
cplc_data IC_module_fabricator
00 00 |..
cplc_data IC_module_packaging_date
00 00 |..
cplc_data ICC_manufacturer
00 00 |..
cplc_data IC_embedding_date
00 00 |..
cplc_data IC_OS_initializer
01 2a |.*
cplc_data IC_OS_initialization_date
00 30 |.0
cplc_data IC_OS_initialization_equipment
30 30 34 33 |0043
cplc_data IC_personalizer
00 00 |..
cplc_data IC_personalization_date
00 00 |..
cplc_data IC_personalization_equipment_ID
00 00 00 00 |....
cplc_data SW
90 00 |..
APDU - Se05x_API_SessionClose []

 

 

 

ラベル(1)
0 件の賞賛
返信
14 返答(返信)

2,023件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

So you are using the nano package but copy the Se05x_API_GetFreeMemory() from the full version of MW : SE-PLUG-TRUST-MW_04.07.00, right? Please kindly clarify.

 

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.
-------------------------------------------------------------------------------

 

0 件の賞賛
返信

2,010件の閲覧回数
kennychiu
Contributor I

Hi Kan,

Yes, I use nanopackage and copy the Se05x_API_GetFreeMemory() from the full version of MW : SE-PLUG-TRUST-MW_04.07.00

Thanks
Kenny


uint32_t freemem;
Se05x_API_GetFreeMemory(&se05x_session, 0x1, &freemem);
printf("%d", freemem);     //500
Se05x_API_GetFreeMemory(&se05x_session, 0x2, &freemem);
printf("%d", freemem);     //764
Se05x_API_GetFreeMemory(&se05x_session, 0x3 &freemem);
printf("%d", freemem);     //752

APDU :DEBUG:kSE05x_TAG_1["memoryType"] = 0x1

APDU Tx>
80 04 00 22 00 00 03 41 |..."...A
01 01 00 00 |....
APDU Rx<
41 02 01 f4 90 00 |A.....
0x01f4 => 500

APDU :DEBUG:kSE05x_TAG_1["memoryType"] = 0x2
APDU Tx>
80 04 00 22 00 00 03 41 |..."...A
01 02 00 00 |....
APDU Rx<
41 02 02 fc 90 00 |A.....
0x02fc => 764

APDU :DEBUG:kSE05x_TAG_1["memoryType"] = 0x3
APDU Tx>
80 04 00 22 00 00 03 41 |..."...A
01 03 00 00 |....
APDU Rx<
41 02 02 f0 90 00 |A.....
0x02f0 => 752

 

0 件の賞賛
返信

1,957件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

I think the SE on your hands might be provisioned with some secure objects already, which consumed the memory inside, so please try to run the se05x_Delete_and_test_provision demo out of the full version of MW , or using the ssscli tool to reset the SE to a known state with the following command:

Kan_Li_0-1748938635239.png

 

BTW, ssscli tool also supports readidlist, if you enabled PlatformSCP already, you have to specify the keys in a text file for authentication before connection. Please kindly refer to the following for more details.

Kan_Li_1-1748938794439.png

 

Hope that helps,

 

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.
-------------------------------------------------------------------------------

 

 

0 件の賞賛
返信

1,939件の閲覧回数
kennychiu
Contributor I

Hi Kan,

I have enabled SCP03 and execute Se05x_API_DeleteAll_Iterative() 

but I get error 6985 on Se05x_API_ReadIDList()

Could you help me resolve this issue?

Thanks


E: # se05x_Delete_and_test_provision !!! Only for testing. NOT FOR PRODUCTION USE!!!!
APDU - CheckObjectExists []

APDU :DEBUG:kSE05x_TAG_1["object id"] = 0x7FFF0206

SCP03: Encrypted Data ==>
84 04 00 27 18 4b cc bf |...'.K..
01 66 6f 01 a5 bd 5f c9 |.fo..._.
61 37 a7 b6 3b 30 ea 92 |a7..;0..
b0 f2 ed 3d 35 |...=5
APDU Tx>
84 04 00 27 18 4b cc bf |...'.K..
01 66 6f 01 a5 bd 5f c9 |.fo..._.
61 37 a7 b6 3b 30 ea 92 |a7..;0..
b0 f2 ed 3d 35 |...=5
APDU Rx<
11 ff 81 1b d9 00 2d 3b |......-;
c0 9f ba ce 06 1b 4b 01 |......K.
9c fc 96 fd b3 2b e8 00 |.....+..
90 00 |..
SCP03: RMAC verified successfully...Decrypt Response Data

SCP03: Decrypted Data ==>
41 01 01 90 00 |A....
APDU - ReadObject []

APDU :DEBUG:kSE05x_TAG_1["object id"] = 0x7FFF0206

APDU :DEBUG:kSE05x_TAG_2["offset"] = 0x0

APDU :DEBUG:kSE05x_TAG_3["length"] = 0x12

SCP03: Encrypted Data ==>
84 02 00 00 00 00 18 53 |.......S
4b 79 d6 a8 7d 6b c0 35 |Ky..}k.5
6e 34 ed b5 52 fc 8e f0 |n4..R...
6b 1a 12 c6 cb 4d b7 00 |k....M..
00 |.
APDU Tx>
84 02 00 00 00 00 18 53 |.......S
4b 79 d6 a8 7d 6b c0 35 |Ky..}k.5
6e 34 ed b5 52 fc 8e f0 |n4..R...
6b 1a 12 c6 cb 4d b7 00 |k....M..
00 |.
APDU Rx<
96 5a dd b3 5e 8f a1 b3 |.Z..^...
0f 75 ce 6d 12 fa 90 28 |.u.m...(
9a 00 9f d5 7a 21 26 79 |....z!&y
b9 2f 98 ca a1 d8 fa 42 |./.....B
c3 fc a0 5d 7d 73 63 77 |...]}scw
90 00 |..
SCP03: RMAC verified successfully...Decrypt Response Data

SCP03: Decrypted Data ==>
41 82 00 12 04 00 50 01 |A.....P.
05 da 80 0f 3a c4 35 04 |....:.5.
2a 00 b2 59 10 90 90 00 |*..Y....
APDU - Se05x_API_ReadIDList []

APDU :DEBUG:kSE05x_TAG_1["output offset"] = 0x0

APDU :DEBUG:kSE05x_TAG_2["filter"] = 0xFF

SCP03: Encrypted Data ==>
84 02 00 25 18 ae 3f 8a |...%..?.
5d ea 8e 5f f9 f5 a7 72 |].._...r
a0 1a 2c a7 16 af 67 6c |..,...gl
8b 7a 50 9b 88 |.zP..
APDU Tx>
84 02 00 25 18 ae 3f 8a |...%..?.
5d ea 8e 5f f9 f5 a7 72 |].._...r
a0 1a 2c a7 16 af 67 6c |..,...gl
8b 7a 50 9b 88 |.zP..
APDU Rx<
69 85 |i.
E: Failed Se05x_API_DeleteAll

0 件の賞賛
返信

1,917件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

Looks like you integrated se05x_Delete_and_test_provision from the full version MW into nano package, but have you also tried it with the full version MW? Was the result the same? This may help us to locate where the problem comes from. BTW, have you also tried the readidlist demo (https://github.com/NXPPlugNTrust/nano-package/tree/master/examples/se05x_ReadIDList )out of the nano package? Did it work as expected on your platform? Please kindly clarify .

 

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.
-------------------------------------------------------------------------------

 

0 件の賞賛
返信

1,902件の閲覧回数
kennychiu
Contributor I

Hi Kan,

>but have you also tried it with the full version MW?

Due to some build issues, I used the nano package to verify the SE050.

 

>have you also tried the readidlist demo (https://github.com/NXPPlugNTrust/nano-package/tree/master/examples/se05x_ReadIDList )out of the nano package? 

Yes,

SCP03 is enabled, and I have updated the ENC and MAC keys according to AN12436.
ex_se05x_GetInfo() runs successfully, so the SCP03 setup should be correct.

 

>Did it work as expected on your platform?

No, I get error code  6985

ex_se05x_ReadIDList

I: Plug and Trust nano package - version: 1.5.4

APDU Tx>
00 a4 04 00 10 a0 00 00 |........
03 96 54 53 00 00 00 01 |..TS....
03 00 00 00 00 00 |......
APDU Rx<
07 02 00 3f 9f ff ff 90 |...?....
00 |.
I: Establish Secure Channel to SE05x !

hostChallenge ==>
11 22 33 44 55 66 77 88 |."3DUfw.
Sending GP Initialize Update Command !!!

APDU Tx>
80 50 0b 00 08 11 22 33 |.P...."3
44 55 66 77 88 |DUfw.
APDU Rx<
90 03 13 47 00 00 43 20 |...G..C
23 16 0b 03 00 05 43 7d |#.....C}
4e 3c 21 3d 20 c4 d8 89 |N<!= ...
c1 27 02 64 c4 90 00 |.'.d...
Output: keyDivData
90 03 13 47 00 00 43 20 |...G..C
23 16 |#.
Output: keyInfo
0b 03 00 |...
Output: cardChallenge
05 43 7d 4e 3c 21 3d 20 |.C}N<!=
Output: cardCryptoGram
c4 d8 89 c1 27 02 64 c4 |....'.d.
Set the Derviation data to generate Session ENC key

Output:scp03_session_enc_Key ==>
01 2c 3f cd b3 4f 6c ff |.,?..Ol.
7e 34 4d 07 5b d0 48 cb |~4M.[.H.
Set the Derviation data to generate Session MAC key

Output:scp03_session_mac_Key ==>
5c ae 32 de a3 a3 61 5e |\.2...a^
2a ae 30 8d 74 22 77 e0 |*.0.t"w.
Set the Derviation data to generate Session RMAC key

Output:scp03_session_rmac_Key ==>
5f bb b8 83 f3 6e 0f 2c |_....n.,
43 58 13 08 83 c7 d4 71 |CX.....q
Output:cardCryptogram ==>
c4 d8 89 c1 27 02 64 c4 |....'.d.
b1 7a db 0a ce a0 ec 5f |.z....._
cardCryptoGram ==>
c4 d8 89 c1 27 02 64 c4 |....'.d.
CardCryptogram verified successfully...Calculate HostCryptogram

Output:hostCryptogram ==>
f0 0f 60 91 b6 f1 fd ee |..`.....
05 af 41 11 75 a2 f6 b5 |..A.u...
hostCryptogram ==>
f0 0f 60 91 b6 f1 fd ee |..`.....
Output: Calculated MAC ==>
bc d1 9e 29 c7 83 89 2d |...)...-
16 28 09 3a b9 e3 b6 4e |.(.:...N
Add calculated MAC Value to cmd Data
Sending GP External Authenticate Command !!!
APDU Tx>
84 82 33 00 10 f0 0f 60 |..3....`
91 b6 f1 fd ee bc d1 9e |........
29 c7 83 89 2d |)...-
APDU Rx<
90 00 |..
Authentication Successful!!!

I: Created scp03 Session

APDU - Se05x_API_ReadIDList []

APDU :DEBUG:kSE05x_TAG_1["output offset"] = 0x0

APDU :DEBUG:kSE05x_TAG_2["filter"] = 0xFF

SCP03: Encrypted Data ==>
84 02 00 25 18 30 34 24 |...%.04$
cf 3a df b5 5a 45 cb e5 |.:..ZE..
f9 87 4d 53 a1 0e 8f 9f |..MS....
7a 36 e8 84 c8 |z6...
APDU Tx>
84 02 00 25 18 30 34 24 |...%.04$
cf 3a df b5 5a 45 cb e5 |.:..ZE..
f9 87 4d 53 a1 0e 8f 9f |..MS....
7a 36 e8 84 c8 |z6...
APDU Rx<
69 85 |i.
E: Error in Se05x_API_ReadIDList

 

 

 

Thanks

0 件の賞賛
返信

1,876件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

I would also suggested you switch back to plain communication to check if the demo still fails, as far as I know,  the case when the SCP authentication succeed but command fails is most likely due to a wrong SCP03 encryption key . SCP Authentication only needs MAC key so the GetInfo demo works well as expected. 

 

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.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,886件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

Thanks for the clarification! Would you please specify how you enabled the SCP03? Did you just run the example of se05x_rotate_scp03_keys to update the SCP keys? Have you tested with other examples like se05x_sign ?

 

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.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,838件の閲覧回数
kennychiu
Contributor I

Hi Kan,

Did you just run the example of se05x_rotate_scp03_keys to update the SCP keys?

No, I don't use se05x_rotate_scp03_keys.

I use ex_se05x_ReadIDList.c and refer AN12436.pdf Table 5.  SE050E
Development Board to update  scp03_enc_key and scp03_mac_key

Have you tested with other examples like se05x_sign ?

success, refer attached file: ex_se05x_sign_scp03_ok.txt


I would also suggested you switch back to plain communication to check if the demo still fails

still fail and get 6985

APDU - Se05x_API_ReadIDList []

APDU :DEBUG:kSE05x_TAG_1["output offset"] = 0x0

APDU :DEBUG:kSE05x_TAG_2["filter"] = 0xFF

APDU Tx>
80 02 00 25 07 41 02 00 |...%.A..
00 42 01 ff |.B..
APDU Rx<
69 85 |i.
E: Error in Se05x_API_ReadIDList

Thanks

0 件の賞賛
返信

1,719件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

This could be due to there are lots of secure objects you created in the SE , so that the response to ReadIDList command can not be held within one standard APDU frame, it needs the extended APDU format which is not supported by this command in the nano package due to buffer limitation, you may try with the full version of MW instead as a quick solution. Alternatively you may update the source code to support extended length for ReadIDList command. Please kindly refer to the following for details.

Kan_Li_0-1749453677847.png

 

Hope that helps,

 

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.
-------------------------------------------------------------------------------

 

0 件の賞賛
返信

1,684件の閲覧回数
kennychiu
Contributor I

Hi Kan,

>Alternatively you may update the source code to support extended length for ReadIDList command.

Se05x_API_ReadIDList()  DoAPDUTxRx(session_ctx, &hdr, &session_ctx->apdu_buffer[0], cmdbufLen, pRspbuf, &rspbufLen, 1);   //set length_extended to 1
Se05x_API_ReadIDList still get error.


I enabled #define ENABLE_T1oI2C_LOGS 1.
When I called Se05x_API_ReadIDList(), I saw some key IDs.

//This is only an example, since I’ve already deleted most of the data.
RAW Rx<
a5 40 51 41 01 01 42 82 |.@QA..B.
00 48 11 22 33 44 f0 00 |.H."3D..
01 03 f0 00 01 01 f0 00 |........
....


I deleted them in a loop using Se05x_API_DeleteSecureObject(), and eventually ex_se05x_ReadIDList ran successfully.

May I ask if the following FLASH and RAM usage are within NXP’s expected range?
Se05x_API_GetFreeMemory(&se05x_session, 0x1, &freemem);
printf("%d", freemem);     //32767
Se05x_API_GetFreeMemory(&se05x_session, 0x2, &freemem);
printf("%d", freemem);     //796
Se05x_API_GetFreeMemory(&se05x_session, 0x3 &freemem);
printf("%d", freemem);     //784

Thanks!


0 件の賞賛
返信

1,664件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

Yes, 32767, 796 and 784 are the expected results.

 

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.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,643件の閲覧回数
kennychiu
Contributor I

Hi Kan,

Thank you very much for your support !

 

 

0 件の賞賛
返信

1,595件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @kennychiu ,

 

You are welcome!

 

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.
-------------------------------------------------------------------------------

0 件の賞賛
返信