As far as you know, we can list the applets that reside in a Java Card using tools such as GlobalPlaformPro
as follow:
GP: gp -list
AID: A000000003000000 (|........|)
ISD OP_READY: Security Domain, Card lock, Card terminate, Default selected
CVM (PIN) management
AID: 010203040506 (|......|)
App SELECTABLE: (none)
AID: 0102030405 (|.....|)
Exe LOADED: (none)
GP:
The questions are:
MF
? or in a DF
?) MF
and all the other EF
s and DF
s of card?DF
? I tried to create a DF
with regard to the commands defined in ISO7816-part9
as below, but I receive errors only!
GP: gp -s 00e00000 -d -v
# Detected readers from SunPCSC
[*] ACS CCID USB Reader 0
SCardConnect("ACS CCID USB Reader 0", T=*) -> T=0, 3Bxxxxxxxxxxxxxxxxxxxxxx
SCardBeginTransaction("ACS CCID USB Reader 0")
Reader: ACS CCID USB Reader 0
ATR: 3Bxxxxxxxxxxxxxxxxxxxxxx
More information about your card:
http://smartcard-atr.appspot.com/parse?ATR=3Bxxxxxxxxxxxxxxxxxxxxxx
A>> T=0 (4+0000) 00A40400 00
A<< (0018+2) (60ms) 6F108408A000000003000000A5049F6501FF 9000
Auto-detected ISD AID: A000000003000000
A>> T=0 (4+0008) 80500000 08 78FF1563FF46D23B
A<< (0028+2) (166ms) 0000116001008A790AF9FF020138983B77E636B6C12237B087216130 90
00
Host challenge: 78FF1563FF46D23B
Card challenge: 0138983B77E636B6
Card reports SCP02 with version 255 keys
Master keys:
Version 0
ENC: Ver:0 ID:0 Type:DES3 Len:16 Value:404142434445464748494A4B4C4D4E4F
MAC: Ver:0 ID:0 Type:DES3 Len:16 Value:404142434445464748494A4B4C4D4E4F
KEK: Ver:0 ID:0 Type:DES3 Len:16 Value:404142434445464748494A4B4C4D4E4F
Sequnce counter: 0138
Derived session keys:
Version 0
ENC: Ver:0 ID:0 Type:DES3 Len:16 Value:4544C6282153F89C2144A2C49784FCC3
MAC: Ver:0 ID:0 Type:DES3 Len:16 Value:017010873EFEC7A838D54C06A9AC2B40
KEK: Ver:0 ID:0 Type:DES3 Len:16 Value:A719298F33D1FECCD89334BA93FC3E70
Verified card cryptogram: C12237B087216130
Calculated host cryptogram: C1CF507F2B48CAEA
A>> T=0 (4+0016) 84820100 10 C1CF507F2B48CAEA7FFA4D851F5C0B1D
A<< (0000+2) (86ms) 9000
A>> T=0 (4+0008) 04E00000 08 08C1F21746AB8A16
A<< (0000+2) (24ms) 6E00
SCardEndTransaction()
SCardDisconnect("ACS CCID USB Reader 0", false)
GP: gp -s 00e000000a003400010101ffff0080 -d -v
# Detected readers from SunPCSC
[*] ACS CCID USB Reader 0
SCardConnect("ACS CCID USB Reader 0", T=*) -> T=0, 3Bxxxxxxxxxxxxxxxxxxxxxx
SCardBeginTransaction("ACS CCID USB Reader 0")
Reader: ACS CCID USB Reader 0
ATR: 3Bxxxxxxxxxxxxxxxxxxxxxx
More information about your card:
http://smartcard-atr.appspot.com/parse?ATR=3Bxxxxxxxxxxxxxxxxxxxxxx
A>> T=0 (4+0000) 00A40400 00
A<< (0018+2) (55ms) 6F108408A000000003000000A5049F6501FF 9000
Auto-detected ISD AID: A000000003000000
A>> T=0 (4+0008) 80500000 08 1B81F8C4D44CC86A
A<< (0028+2) (166ms) 0000116001008A790AF9FF0201391213E503ADE77D8CC6A546AE3537 90
00
Host challenge: 1B81F8C4D44CC86A
Card challenge: 01391213E503ADE7
Card reports SCP02 with version 255 keys
Master keys:
Version 0
ENC: Ver:0 ID:0 Type:DES3 Len:16 Value:404142434445464748494A4B4C4D4E4F
MAC: Ver:0 ID:0 Type:DES3 Len:16 Value:404142434445464748494A4B4C4D4E4F
KEK: Ver:0 ID:0 Type:DES3 Len:16 Value:404142434445464748494A4B4C4D4E4F
Sequnce counter: 0139
Derived session keys:
Version 0
ENC: Ver:0 ID:0 Type:DES3 Len:16 Value:F02DB909386D90DA638ACA4AB92501E1
MAC: Ver:0 ID:0 Type:DES3 Len:16 Value:FD6A2A492566BDE1940C54127C022126
KEK: Ver:0 ID:0 Type:DES3 Len:16 Value:98FAA5CF01E133557688FD90E1571FAC
Verified card cryptogram: 7D8CC6A546AE3537
Calculated host cryptogram: 14C22B8CE836A4D4
A>> T=0 (4+0016) 84820100 10 14C22B8CE836A4D4C2F1C20A8CD56F8C
A<< (0000+2) (85ms) 9000
A>> T=0 (4+0018) 04E00000 12 003400010101FFFF0080B9174FA320EEC470
A<< (0000+2) (24ms) 6E00
SCardEndTransaction()
SCardDisconnect("ACS CCID USB Reader 0", false)
GP:
Why I can't create my desired file?
Where are these applets in the card? (in the MF or in a DF?)
Consider each Java Card application to be a DF directly below the MF. Though, be aware that Java Cards only make use of parts of the ISO 7816-4 file system concept and that the MF itself is not necessarily selectable by default.
Who choose it? (The directory that applets installed there)
The Java Card specifications partially define this (through the way how the SELECT (by AID) command is defined; other than that Java Cards do not make use of the file system concept).
Is there any way to see the AID of MF and all the other EFs and DFs of card?
From an API perspective, only DF names can be AIDs. Consider AIDs to be DF names that comply to a specific format. MF and EF have file IDs. However, as there is no file system concept on Java Cards, there are no addressable MF, EFs by default (you can emulate this functionality though applet code). So the only listable components that are on a Java Card are applets and applet packages (which you already found to be listable though Global Platform card management for your card).
What is my current directory? Can I change it?
See above. No file system concept -> no notion of a "current directory". If you are within an application (selected applet), the applet can emulate a file system. In that case things like a "current" directory" depend on the applet implementation.
And how I can create a DF?
By installing (and making selectable) an applet.