Upload a .cap file on Smart Card?

孤街醉人 提交于 2019-12-02 06:25:14

问题


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

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

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.

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

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

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)

回答1:


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).

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?).

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.



来源:https://stackoverflow.com/questions/23670367/upload-a-cap-file-on-smart-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!