I’m trying to install an applet (.cap file) into a smart card. I read that 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 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):
header: 0x80 0xb8 0x00 0x00
lc aid:
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.
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
.capfile (as APDU’s may only contain 255 bytes payload – GP does not use extended length). Then you issue anINSTALL for INSTALLcommand 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/