简体   繁体   中英

how can i change my JAVA card life cycle state to OP_READY?

I found the below script in the Oracle ( This lint ) and run it via GPShell on my java card and now I can't run gpj -list in GPJ !

My questions:

1- What is this code for? changing Card Domain Manager status from OP_READY to Secured?

2- Why I can't find anywhere 80F0800708A000000003000000 And 80F0800F08A000000003000000 APDUs that used in script?! I searched GP Specification 2.2 and ISO 7814-4 for an APDU with F0 in CLA section! But I found nothing!

3- Is the operation of the below script reversible by another script?

The Script :

mode_211
enable_trace
establish_context
card_connect

select -AID A0000000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 

404142434445464748494a4b4c4d4e4f
send_apdu -sc 1 -APDU 80F0800708A000000003000000
send_apdu -sc 1 -APDU 80F0800F08A000000003000000
card_disconnect
release_context

And this is it's output in Console :

C:\Users\ghasemi\Desktop\GPShell-1.4.4>gpshell lcchange.txt
mode_211
enable_trace
establish_context
card_connect
select -AID a00000
Command --> 00A4040003A00000
Wrapped command --> 00A4040003A00000
Response <-- 6F108408A000000003000000A5049F6501FF9000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4
f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4
d4e4f
Command --> 80CA006600
Wrapped command --> 80CA006600
Response <-- 664C734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864
886FC6B03640B06092A864886FC6B040215650B06092B8510864864020103660C060A2B060104012
A026E01029000
Command --> 805000000823CE2F4C2B6C689B00
Wrapped command --> 805000000823CE2F4C2B6C689B00
Response <-- 0000116001007F8B0AF9020201D1C94E4F787D75DD54805A7488BCF79000
Command --> 84820100100BCCFE8818D2DFC6E5B48EA4B6892457
Wrapped command --> 84820100100BCCFE8818D2DFC6E5B48EA4B6892457
Response <-- 9000
send_apdu -sc 1 -APDU 80F0800708A000000003000000
Command --> 80F0800708A000000003000000
Wrapped command --> 84F0800710A0000000030000007AA29B3A708E6E75
Response <-- 9000
send_APDU() returns 0x80209000 (9000: Success. No error.)
send_apdu -sc 1 -APDU 80F0800F08A000000003000000
Command --> 80F0800F08A000000003000000
Wrapped command --> 84F0800F10A0000000030000004FCFC15FD7EBDE9A
Response <-- 9000
send_APDU() returns 0x80209000 (9000: Success. No error.)
card_disconnect
release_context

Thankyou.

What is this code for?

80 F0 8007 08 A000000003000000

This is a SET STATUS (INS = 0xF0 ) command to set the issuer security domain (P1 = 0x80 ) to INITIALIZED state (P2 = 0x07 ).

80 F0 800F 08 A000000003000000

This is a SET STATUS (INS = 0xF0 ) command to set the issuer security domain (P1 = 0x80 ) to SECURED state (P2 = 0x0F ).

Why I can't find those APDUs used in the script anywhere?

Most likely because you did not properly read the Global Platform Card specification (eg see section 11.10 in GP Card Specification 2.2.1). Btw. searching for 'F0' (the second byte of a C-APDU is INS not CLA) would certainly have helped.

Is the operation of the script reversible?

Again, actually reading the specification would have helped. There is a nice state transition diagram in Figure 5-1 that clearly indicates that transitions to INITIALIZED, SECURED and TERMINATED states are irreversible (so does the text in section 5.1.1).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM