简体   繁体   English

如何在javacard上更改applet的生命周期?

[英]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 : 我已经在智能卡上上传了一个HelloWorld.cap小程序,当我使用gpj -list命令时,该卡返回以下输出:

    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 . 如您所见,我的applet的生命周期为7,其package的生命周期为7。package和applet的特权均为0x00。 how I can change them?(PR and LC) 如何更改它们?(PR和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. Applet特权和生命周期状态在GlobalPlatform卡规范中进行了描述,您可以从http://www.globalplatform.org/specificationscard.asp下载这是一个很长的文档,并不是特别容易阅读,但是我确实建议您仔细阅读如果您打算使用智能卡。

It explains how to assign privileges for applets (mostly at installation time) and how to transition through the different life cycle states. 它说明了如何为applet分配特权(主要是在安装时)以及如何在不同的生命周期状态之间过渡。 For example, it says that your Hello World applet is already in SELECTABLE state, so it can only transition to LOCKED or be deleted. 例如,它说您的Hello World小程序已经处于SELECTABLE状态,因此它只能转换为LOCKED或被删除。

In order to change LC (Life Cycle) use Set-Status APDUs: 为了更改LC (生命周期),请使用设置状态 APDU:

for example : 例如 :

OP_READY To INITIALIZED : 80 F0 P1 07 |Lc| AID OP_READY初始化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 80 F0 P1 0F |Lc| AID

P1 = 40 : For Applications (Including SSDs) P1 = 40 :适用于应用程序(包括SSD)

P1 = 80 : For ISD P1 = 80 :对于ISD

And in order to change PR (Privilege) you should add -priv parameter to gpj install command. 并且为了更改PR (特权),您应该在gpj install命令中添加-priv参数。

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

http://www.oracle.com/technetwork/java/javacard/javacard1-139251.html#_Lifecycle_of_a 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? 因此,这毕竟不是可以更改的东西,对吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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