在智能卡上上传.cap文件?

时间:2014-05-15 06:00:52

标签: smartcard javacard apdu globalplatform

我有一张新卡,下面的代码作为ATR。

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

我在谷歌搜索了这个ATR,最后我知道这是一张“巴西e-CPF卡”。 问题是我如何使用这张卡?我的意思是它支持的APDU是什么?它有什么数据表吗?它是一个javacard? [如果是的话]我怎样才能上传.cap文件?它有任何默认密钥吗? 还有很多这样的问题。

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

btw我使用ACR38智能卡读卡器。我在Eclipse中创建了一个.cap javacard程序。

下一个问题: 我使用GPJ.bat在此卡上部署(上传).cap文件。 [使用Eclipse流行的HelloWorld程序制作的.cap文件及其源代码在这里:http://umer555.wordpress.com/2012/05/17/java-card-hello-world-applet/]

输出如下。上传有什么问题?和整个过程!

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)

1 个答案:

答案 0 :(得分:3)

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

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

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