简体   繁体   English

在JavaCard中安装小程序

[英]Installing applet in javacard

I made a .cap file of the popular "Hello World" javacard code via Eclipse 我通过Eclipse创建了流行的“ Hello World” javacard代码的.cap文件

And now I want to load it in a real javacard via GPShell and ACR38 smart card reader. 现在,我想通过GPShell和ACR38智能卡读取器将其加载到真实的Java卡中。

question: Am I need any key to load the .cap file in the card? 问题:我需要任何密钥才能将.cap文件加载到卡中吗? I mean, should I authenticate before uploading my applet in the card or it's not necessory? 我的意思是,我应该在将小程序上传到卡中之前进行身份验证吗?还是不需要? I think it is mndatory to authenticate. 我认为必须进行身份验证。 it is irrational to upload .cap without authentication. 在不进行身份验证的情况下上传.cap是不合理的。 but I don't know , how to authenticate. 但我不知道如何进行身份验证。 question: What's wrong in this? 问题:这有什么问题?

C:\Users\ghasemi>java -jar e:\gpj\gpj.jar -load e:\helloWorld.cap -install
Found terminals: [PC/SC terminal ACS CCID USB Reader 0]
javax.smartcardio.CardException: connect() failed
        at sun.security.smartcardio.TerminalImpl.connect(Unknown Source)
        at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
ource)
Caused by: sun.security.smartcardio.PCSCException: SCARD_E_SHARING_VIOLATION
        at sun.security.smartcardio.PCSC.SCardConnect(Native Method)
        at sun.security.smartcardio.CardImpl.<init>(Unknown Source)
        ... 2 more
Found card in terminal: ACS CCID USB Reader 0
java.lang.NullPointerException
        at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
ource)

C:\Users\ghasemi>java -jar e:\gpj\gpj.jar -load e:\helloWorld.cap -install

Found terminals: [PC/SC terminal ACS CCID USB Reader 0]

Found card in terminal: ACS CCID USB Reader 0

ATR: 3B 7F 94 00 00 80 31 80 65 B0 85 02 02 ED 12 0F FF 82 90 00

DEBUG: Command  APDU: 00 A4 04 00 07 A0 00 00 01 51 00 00

DEBUG: Response APDU: 6A 82

Failed to select Security Domain GP211 A0 00 00 01 51 00 00 , SW: 6A 82
DEBUG: Command  APDU: 00 A4 04 00 08 A0 00 00 00 18 43 4D 00

DEBUG: Response APDU: 6F 65 84 08 A0 00 00 00 18 43 4D 00 A5 59 73 4A 06 07 2A 8
6 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48
86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 01 05 65 0B 06 09 2B 85 10 86 48 64
 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 9F 6E 06 12 91 20 11 02 02 9
F 65 01 FF 90 00

Successfully selected Security Domain GemaltoXpressPro A0 00 00 00 18 43 4D 00
DEBUG: Command  APDU: 80 50 00 00 08 17 2A 53 4F AC DF 8D 16

DEBUG: Response APDU: 69 82

javax.smartcardio.CardException: Wrong initialize update, SW: 69 82
        at net.sourceforge.gpj.cardservices.GlobalPlatformService.openSecureChan
nel(Unknown Source)
        at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
ource)

tnx n

Response code 6A 82 is used for Security_Status_Not_Satisfied . 响应代码6A 82用于Security_Status_Not_Satisfied

On selection of Security Domain , this status word may occur due to one of following two reasons : 选择Security Domain ,由于以下两个原因之一,可能会出现此状态字:

  • Either Card Life Cycle State (CLCS) of Card is LOCKED or TERMINATED , so the selection of Security Domain is not allowed, because if the CLCS is LOCKED then only that security domain and/or application can be selected which has Card Lock privilege, and if CLCS is TERMINATED then if a Security Domain has the Final Application privilege only the GET DATA command shall be processed, all other commands shall be disabled and shall return an error.If the CLCS is LOCKED then try to select that security domain and/or application which has Card Lock privilege and try to move Card Life Cycle State (CLCS) to SECURED using SETSTATUS command with the help of SCP session ,otherwise if CLCS is TERMINATED then CLCS can't switch back to SECURED, as this state is irreversible. 卡的卡Life Cycle State (CLCS)LOCKEDTERMINATED ,因此不允许选择安全域,因为如果CLCS为LOCKED则只能选择具有Card Lock特权的安全域和/或应用程序,并且如果CLCS被TERMINATED则如果安全域具有` TERMINATED最终应用程序''特权,则仅应处理GET DATA命令,所有其他命令应被禁用并返回错误;如果CLCS被LOCKED则尝试选择该安全域和/或具有卡锁特权并尝试在SCP session的帮助下使用SETSTATUS命令将卡生命周期状态(CLCS)移至SECURED应用程序,否则,如果CLCS被TERMINATED则CLCS无法切换回SECURED,因为此状态是不可逆的。

  • OR the Security Domain , which you try to select is itself in LOCKED state, in this case that Security Domain may be prevented from further selection by the OPEN and error status word is returned. 或您尝试选择的Security Domain本身处于LOCKED状态,在这种情况下,OPEN可能会阻止安全域进一步选择,并返回错误状态字。

@CLCS - Card Life Cycle State. @CLCS-卡生命周期状态。

Happy to Help. 乐意效劳。

You should require about the Global Platform state of the card. 您应该要求有关卡的全球平台状态。 6982 is a general status word that means "Security status not satisfied", so your card may be in the wrong state (eg the Global Platform LOCKED or TERMINATED state). 6982是一个常规状态字,表示“安全状态未满足”,因此您的卡可能处于错误状态(例如,全局平台已锁定或已终止)。

It could also be that you are using an invalid Global Platform key set, or that the keys are not available. 也可能是您使用了无效的Global Platform密钥集,或者这些密钥不可用。

Please contact the supplier of the smart card about the card state and which keys you should use. 请与智能卡的供应商联系,以了解卡的状态以及应使用的密钥。

the Card Manager AID shows that it is a Gemalto XPresso Card. 卡管理器AID显示它是金雅拓XPresso卡。 the default cards for this card is 47454d5850524553534f53414d504c45 try to set those keys. 该卡的默认卡为47454d5850524553534f53414d504c45尝试设置这些密钥。 in case it does not work the card has changed CM Keys or the Card might be locked beware that trying to authenticate too often with wrong keys might lock the card 如果它不起作用,则该卡已更改CM密钥,或者该卡可能已被锁定,请注意,尝试使用错误的密钥进行过多的身份验证可能会锁定该卡

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

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