在智能卡上上传.cap文件? [英] Upload a .cap file on Smart Card?

查看:101
本文介绍了在智能卡上上传.cap文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张新的卡,上面的代码是其ATR.

I have a fresh card with the below code as its ATR.

3B 68 00 00 00 73 C8 40 12 00 90 00

我在Google中搜索了该ATR,最后我知道这是巴西e-CPF卡". 问题是如何使用此卡?我是说它支持哪些APDU?有任何数据表吗?它是javacard吗? [如果是]如何在其中上传.cap文件?是否有任何默认密钥? 还有很多这类问题.

I searched this ATR in google and finally I know this is a "Brazilian e-CPF card". the question is how I can use this card? I mean what APDUs for example it supports? is there any datasheet for it? is it a javacard? [if yes] how I can upload a .cap file in it? is there any default key for it? and a lot of this kind of questions.

主要问题是:我可以从ATR中获得什么样的数据?

the mainly question is that : what kind of data I can gain from an ATR?

顺便说一句,我使用ACR38 SmartCard读卡器.然后在Eclipse中创建一个.cap javacard程序.

btw I use ACR38 SmartCard reader. and I create a .cap javacard program in Eclipse.

下一个问题: 我使用GPJ.bat在此卡上部署(上传).cap文件. [使用Eclipse的Popular HelloWorld程序制作的.cap文件及其源代码位于:

Next Question: I use GPJ.bat to deploy(upload) a .cap file on this card. [the .cap file made with Eclipse of the Popular HelloWorld program and its source code is here : http://umer555.wordpress.com/2012/05/17/java-card-hello-world-applet/]

输出如下.上传有什么问题?并完成整个过程!

Output is below. what is wrong with uploading? and with the total process!

E:\gpj>gpj -load e:\helloworld.cap -install

E:\gpj>java -jar 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 68 00 00 00 73 C8 40 12 00 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: 6A 82
Failed to select Security Domain GemaltoXpressPro A0 00 00 00 18 43 4D 00 , SW:
6A 82
DEBUG: Command  APDU: 00 A4 04 00 08 A0 00 00 00 03 00 00 00
DEBUG: Response APDU: 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF 90 0
0
Successfully selected Security Domain OP201a A0 00 00 00 03 00 00 00
DEBUG: Command  APDU: 80 50 00 00 08 34 F8 63 3E E3 BC 64 94
DEBUG: Response APDU: 00 00 11 60 01 00 7F 8B 0A F9 FF 02 00 01 6C 7F FC 11 3F B
9 3F 17 B8 84 02 AA C1 F0 90 00
DEBUG: Command  APDU: 84 82 00 00 10 08 EA 79 CD BA 32 F3 1C 69 1B 83 42 CD AA F
E 42
DEBUG: Response APDU: 90 00
DEBUG: Command  APDU: 84 82 00 00 08 08 EA 79 CD BA 32 F3 1C
DEBUG: Response APDU: 90 00
DEBUG: packagePath: helloWorld/javacard/
DEBUG: package: helloWorld
DEBUG: package AID: 01 02 03 04 05 06 07 08 09 00
DEBUG: applet AIDs: [01 02 03 04 05 06 07 08 09 00 00 ]
DEBUG: Command  APDU: 80 E6 02 00 17 0A 01 02 03 04 05 06 07 08 09 00 08 A0 00 0
0 00 03 00 00 00 00 00 00
DEBUG: Response APDU: 00 90 00
DEBUG: Command  APDU: 80 E6 02 00 17 0A 01 02 03 04 05 06 07 08 09 00 08 A0 00 0
0 00 03 00 00 00 00 00 00
DEBUG: Response APDU: 00 90 00
DEBUG: Command  APDU: 80 E8 00 00 FF C4 82 01 63 01 00 1F DE CA FF ED 02 02 06 0
0 01 0A 01 02 03 04 05 06 07 08 09 00 0A 68 65 6C 6C 6F 57 6F 72 6C 64 02 00 21
00 1F 00 21 00 0F 00 2A 00 22 00 5A 00 35 00 0A 00 0C 00 05 00 AA 00 00 00 00 00
 00 00 00 04 01 00 04 00 2A 04 00 01 07 A0 00 00 00 62 00 01 00 01 07 A0 00 00 0
0 62 00 03 03 01 07 A0 00 00 00 62 01 01 00 01 08 A0 00 00 00 62 01 01 01 03 00
0F 01 0B 01 02 03 04 05 06 07 08 09 00 00 00 13 06 00 5A 00 00 A1 81 00 0C 48 65
 6C 6C 6F 57 6F 72 6C 64 52 49 C1 82 02 22 83 05 00 FF 00 01 00 00 00 81 00 00 0
0 02 00 00 00 10 48 65 6C 6C 6F 57 6F 72 6C 64 52 49 49 6D 70 6C 01 00 02 00 82
03 00 FF 00 07 01 00 00 00 1C 42 80 00 00 FF 00 01 01 00 00 00 31 82 02 00 00 12
 01 01 07 00 35 00 01 10 18 8C 00 00 7A 01 10 18 8C 00 01 18 8B 00 02 7A 01 30 8
F
DEBUG: Response APDU: 69 85
DEBUG: Command  APDU: 80 E8 00 00 FF C4 82 01 63 01 00 1F DE CA FF ED 02 02 06 0
0 01 0A 01 02 03 04 05 06 07 08 09 00 0A 68 65 6C 6C 6F 57 6F 72 6C 64 02 00 21
00 1F 00 21 00 0F 00 2A 00 22 00 5A 00 35 00 0A 00 0C 00 05 00 AA 00 00 00 00 00
 00 00 00 04 01 00 04 00 2A 04 00 01 07 A0 00 00 00 62 00 01 00 01 07 A0 00 00 0
0 62 00 03 03 01 07 A0 00 00 00 62 01 01 00 01 08 A0 00 00 00 62 01 01 01 03 00
0F 01 0B 01 02 03 04 05 06 07 08 09 00 00 00 13 06 00 5A 00 00 A1 81 00 0C 48 65
 6C 6C 6F 57 6F 72 6C 64 52 49 C1 82 02 22 83 05 00 FF 00 01 00 00 00 81 00 00 0
0 02 00 00 00 10 48 65 6C 6C 6F 57 6F 72 6C 64 52 49 49 6D 70 6C 01 00 02 00 82
03 00 FF 00 07 01 00 00 00 1C 42 80 00 00 FF 00 01 01 00 00 00 31 82 02 00 00 12
 01 01 07 00 35 00 01 10 18 8C 00 00 7A 01 10 18 8C 00 01 18 8B 00 02 7A 01 30 8
F
DEBUG: Response APDU: 69 85
net.sourceforge.gpj.cardservices.exceptions.GPLoadException: Load failed, SW: 69
 85
        at net.sourceforge.gpj.cardservices.GlobalPlatformService.loadCapFile(Un
known Source)
        at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
ource)

推荐答案

ATR通常不提供有关卡的有用信息.从APDU跟踪中,您可以看到该卡符合GlobalPlatform,并且可以通过AID A0 00 00 00 03 00 00 00来访问其发行者安全域OPEN(此可以-但不一定如此-表示JCOP卡).

The ATR usually does not provide much useful information about a card. From the APDU trace you can see that the card is GlobalPlatform compliant and that its issuer security domain OPEN is accessible through the AID A0 00 00 00 03 00 00 00 (this could -- but not necessarily does -- indicate a JCOP card).

选择了AID之后,GPJ将执行成功的身份验证序列(INITIALIZE UPDATE,然后进行EXTERNAL AUTHENTICATE).这表示您可以使用配置GPJ的任何密钥集访问该卡(或者它是否使用某些默认密钥?).

After that AID has been selected GPJ performs a successful authentication sequence (INITIALIZE UPDATE followed by EXTERNAL AUTHENTICATE). This indicates that you have access to that card using whatever keyset you configured GPJ with (or does it use some default keys?).

然后,在成功通过身份验证之后,GPJ尝试安装该helloworld Java Card applet. INSTALL命令成功,而加载实际的应用程序代码包失败.这可能有几个原因.最常见的一种情况(假设卡是Java卡)是针对与卡所支持的Java卡API不同的Java小程序进行编译的.在这种情况下,您将需要针对正确的Java Card平台版本重新编译applet.

Then, after the successful authentication, GPJ tries to install that helloworld Java Card applet. The INSTALL command is successful, while loading the actual application code package fails. This could have several reasons. The most common one (assuming that the card is a Java Card) is that the applet is compiled for a different Java Card API than the card supports. In that case, you would need to recompile the applet for the correct Java Card platform version.

这篇关于在智能卡上上传.cap文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆