简体   繁体   中英

How to change an applet's life cycle on javacard?

I have uploaded a HelloWorld.cap applet on smartcard and when I use gpj -list command the card return below output :

    D:\gpj>java -jar gpj.jar -list
    Found terminals: [PC/SC terminal ACS CCID USB Reader 0]
    Found card in terminal: ACS CCID USB Reader 0
    ATR: 3B 68 00 00 00 73 C8 40 12 00 90 00
     .
     .
     .

    AID: A0 00 00 00 03 00 00 00                       |........|        ISD LC: 1 P
    R: 0x9E

    AID: 11 22 33 44 55 66                             |."3DUf|          App LC: 7 P
    R: 0x00

    AID: 11 22 33 44 55                                |."3DU|           Exe LC: 1 P
    R: 0x00

As you see the life cycle of my applet is 7 and life cycle of its package is 7. And for both of package and applet privilege is 0x00 . how I can change them?(PR and LC)

Applet privileges and life cycle states are described in GlobalPlatform Card Specification, you can download it from http://www.globalplatform.org/specificationscard.asp It is a long document and not particularly easy to read, but I really recommend going through it if you plan to work with smart cards.

It explains how to assign privileges for applets (mostly at installation time) and how to transition through the different life cycle states. For example, it says that your Hello World applet is already in SELECTABLE state, so it can only transition to LOCKED or be deleted.

In order to change LC (Life Cycle) use Set-Status APDUs:

for example :

OP_READY To INITIALIZED : 80 F0 P1 07 |Lc| AID 80 F0 P1 07 |Lc| AID

INITIALIZED To SECURED : 80 F0 P1 0F |Lc| AID 80 F0 P1 0F |Lc| AID

P1 = 40 : For Applications (Including SSDs)

P1 = 80 : For ISD

And in order to change PR (Privilege) you should add -priv parameter to gpj install command.

for example : gpj -load helloWorld.cap - install -priv 0x04

http://www.oracle.com/technetwork/java/javacard/javacard1-139251.html#_Lifecycle_of_a

according to that, it is not something you can change after all, is it?

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