This is an academic project, which aims to customise a JavaCard applet to perform functionalities for a specific use case
The objective of this project is to create an applet inspired by the ACOS3 card from the company ACS.
The applet must support a set of instructions described in the specifications and manage the application files, while taking into account the different exceptions and special cases of use.
In general, a JavaCard technology architecture is presented as follows :
-
The applet contains a single application/class. CLA = 0x80
-
Give access to the three highest priority files :
- FF02, which contains a byte (NBRE_OF_FILE), with the attribute "IC code" (for reading and writing)
- FF03, which contains 8 bytes (IC code and PIN code)
- FF04, which contains 6 * 30 bytes (30 is the maximum number of files authorized to create), the six bytes have the same structure as that of the ACOS3 card. (see the following image)
- The applet must accept the following statements: SELECT_FILE, READ_RECORD, WRITE_RECORD, SUBMIT_CODE, CLEAR_CARD
File | Statement | Associated Variables |
---|---|---|
FF02 |
public static byte [] FF02 = {(byte)0x00}; | FF02_selected |
FF03 |
public static byte [] FF03 = {(byte)0xAA, (byte)0xBB, (byte)0xCC, (byte)0xDD, (byte)0x00, (byte)0xBC, (byte)0x61, (byte)0x4E}; // default IC code and PIN code | FF03_selected |
FF04 |
public static byte [] FF04 = new byte[30*6]; | FF04_selected |
AA00 |
public static byte [] AA00 = new byte[1024]; // a transparent file that contains all user files to be created | USER_FILE_selected |
Instruction | Statement (Type: public static final byte) | Corresponding APDU Command | ||||||
---|---|---|---|---|---|---|---|---|
CLA | INS | P1 | P2 | Lc | Data | Le | ||
SELECT_FILE | ins_SELECT_FILE = (byte) 0xA4; | 0x80 | 0xA4 | 0x00 | 0x00 | 0x02 | MSB and LSB parts* (file name) | 0x00 |
READ_RECORD | ins_READ_RECORD = (byte) 0xB2; | 0x80 | 0xB2 | 0x00 | 0x00 | 0x01 | 0x00 | Number of bytes to read |
WRITE_RECORD | ins_WRITE_RECORD = (byte) 0xD2; | 0x80 | 0xD2 | 0x00 | 0x00 | Number of bytes to write | Bytes to be written in the selected file | 0x00 |
SUBMIT_CODE | ins_SUBMIT_CODE = (byte) 0x20; | 0x80 | 0x20 | 0x00 | 0x00 | 0x08 or* 0x00 | IC code and OIN code | 0x00 |
CLEAR_CARD | ins_CLEAR_CARD = (byte) 0x30; | 0x80 | 0x30 | 0x00 | 0x00 | 0x00 | void | 0x00 |
*Notes :
-
MSB and LMB stand respectively for the Most Significant Bit and the Least Significant Bit
-
For the instruction SUBMIT_CODE, Lc take :
- 0x08 : if you want to submit the administrator code (which gives access to the files FF02, FF03 and FF04)
- 0x02 : if you want to submit the code for the use of newly created user files
The project contains two files :
- JavaCard_Applet.java : contains the code correspending to the applet
- Testing_Script.scr : contains a script that describes a specific scenario for the use of the developed applet. Mainly compesed of APDU commands. The results will be visible in the output window. This is alowing us to test our applet and check the consistency of the APDU responses for each APDU command
- Email - oussama.oulkaid@gmail.com
- LinkedIn - Oussama Oulkaid