简体   繁体   中英

Java Card applet: How to create EFs,DFs in smart card?

I'm a newbie in Java Card development and I'm trying to develop an applet that can select and read EF data. I would like to create EFs and DFs with some fake data and store it in the card. Then I would use my applet to read these data. Is it possible? If so, how can I do that? Please help, I've searched a lot but I did not find any solution for that.

Many thanks.

In a time long gone there was a file system API for Java Card. That API however has been deprecated. That means that you have to implement a proprietary version of CREATE FILE and the ISO versions of READ BINARY and UPDATE BINARY yourself. You may also want to implement SELECT by ID if you don't want to rely on implicit selection by SFI. These commands have been defined in the ISO/IEC 7816-4 standard (payware, but there is info availale online). You may want to constrain yourself to implementing "transparent" EF files which are just binary files as you are used to in your operating system.

Usually the files consist of an (object containing a) Java Card byte array in EEPROM (just new byte[size] ) for the file and meta information - maybe also in a byte[] ) such as read/write access conditions. This is fine unless you need over 32Ki of memory, in which case you require multiple byte arrays.

A DF may consist of EF's, objects such as keys, PIN's, access conditions. The applet itself is a named DF, but you can createa a specific CREATE FILE for creating DF's. You would of course have to support the DF selection as well within SELECT by ID . Furthermore, you should keep a reference to the currently selected DF and EF in transient memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM