Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Upload CAP file to smart card using APDU

JavaCard Applet Development Related Questions and Answers.
User avatar
rainly
Posts: 11
Joined: Tue Jun 09, 2015 4:38 am
Points :18
Contact:

Upload CAP file to smart card using APDU

Post by rainly » Wed Jun 10, 2015 3:35 am

I'm trying to install an applet (.cap file) into a smart card. I see that it can be done using APDU. I created my applet using Netbeans and its aid is //aid/9AE9BE4D27/53.

Firstly build apdu that will select the

Code: Select all

installer applet:
0x00 0xA4 0x04 0x00 0X09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;

Then build the apdu which will create my applet (following this sctructure):

Code: Select all

header: 0x80 0xb8 0x00 0x00
lc aid length:
aid:
le: 0x7F;

I developed an application which can send an apdu command to a real card using channel.transmit(new CommandAPDU(apdu). I guess that if I send the proper installation command, my .cap file should be installed in the card.

With this information can anyone help me to build the correct apdu to install my cap file into a real card?

Thank you.

User avatar
Ellisun
Posts: 50
Joined: Wed May 20, 2015 3:47 am
Points :472
Contact:

Re: Upload CAP file to smart card using APDU

Post by Ellisun » Wed Jun 10, 2015 5:08 am

If the card is using Global Platform, then it's not that simple, you need to authenticated against the card manager. Then you send multiple commands to load the .cap file (as APDU's may only contain 255 bytes payload - GP does not use extended length). Then you issue an INSTALL for INSTALL command to instantiate the Applet (using the instance AID).

Fortunately for you, there are open source libraries available that are build on top of javax.smartcardio. I would still recommend to read through the basics of Global Platform though, the documents can be obtained online without charge.
http://sourceforge.net/projects/gpj/

User avatar
rainly
Posts: 11
Joined: Tue Jun 09, 2015 4:38 am
Points :18
Contact:

Re: Upload CAP file to smart card using APDU

Post by rainly » Wed Jun 10, 2015 5:27 am

Thank you for your answer, Seems it won't be so easy. Any attempt of communicating with PC/SC card fails (Failed to select Security Domain). I guess I will need to authenticate somehow.

User avatar
Tolice
Posts: 40
Joined: Wed May 20, 2015 2:41 am
Points :254
Contact:

Re: Upload CAP file to smart card using APDU

Post by Tolice » Wed Jun 10, 2015 6:05 am

Yes if you are sending the correct command APDUs then you will be able to install it but in case of Global-platform cards you will need to create secure channel first and then you might send Install For Load and subsequent load/install commands. The sequence of steps will be:

    1. Select card manager (00 A4 04 00 08 A0 00 00 00 03 00 00 00 00)
    2. Authenticate your card with SCP01/SCO02 whichever is supported by your card (84 82 P1 P2 Lc Data Le)
    3. Send Install For load command(80 E6 02 P2 Lc Data Le)
    4. Send load commands (80 E8 P1 P2 Lc Data Le)
    5. Send Install For Install command(80 E6 0C P2 Lc Data Le)
And every APDU commands should return 0x9000, that means these APDU commands are executed successfully.

User avatar
product
Posts: 106
Joined: Wed May 20, 2015 2:04 am
Points :658
Contact:

Re: Upload CAP file to smart card using APDU

Post by product » Wed Jun 10, 2015 7:05 am

If the card is supporting Global Platform Card Specification, you can try the pyApduool in Development Kit. By using pyApdutool, you can upload the cap into the smart card, and automatically installed this applet.such as
You do not have the required permissions to view the files attached to this post. Please login first.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: Google [Bot] and 45 guests

JavaCard OS : Disclaimer