user3628920
user3628920

Reputation: 397

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)

Upvotes: 2

Views: 710

Answers (3)

Ebrahim Ghasemi
Ebrahim Ghasemi

Reputation: 6126

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

for example :

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

INITIALIZED To SECURED : 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

Upvotes: 1

mictter
mictter

Reputation: 1418

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.

Upvotes: 3

achiever
achiever

Reputation: 309

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?

Upvotes: 0

Related Questions