title: Smart cards and their files
body: <p>As far as you know, we can list the applets that reside in a Java Card using tools such as <code>GlobalPlaformPro</code> as follow: </p>
  
  <pre><code>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:
  </code></pre>
  
  <p>The questions are:  </p>
  
  <ol>
  <li>Where are these applets in the card? (in the <code>MF</code>? or in a <code>DF</code>?) </li>
  <li>Who choose it? (the directory that applets get installed to)</li>
  <li>Is there any way to see the AID of <code>MF</code> and all the other <code>EF</code>s and <code>DF</code>s of card?</li>
  <li>What is my current directory? Can I change it? </li>
  <li>And how I can create a <code>DF</code>? </li>
  </ol>
  
  <p>I tried to create a <code>DF</code> with regard to the commands defined in <code>ISO7816-part9</code> as below, but I receive errors only!</p>
  
  <p><img src="https://i.stack.imgur.com/AeLvc.png" alt="enter image description here"></p>
  
  <pre><code>GP: gp -s 00e00000 -d -v
  # Detected readers from SunPCSC
  [*] ACS CCID USB Reader 0
  SCardConnect("ACS CCID USB Reader 0", T=*) -&gt; 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&gt;&gt; T=0 (4+0000) 00A40400 00
  A&lt;&lt; (0018+2) (60ms) 6F108408A000000003000000A5049F6501FF 9000
  Auto-detected ISD AID: A000000003000000
  A&gt;&gt; T=0 (4+0008) 80500000 08 78FF1563FF46D23B
  A&lt;&lt; (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&gt;&gt; T=0 (4+0016) 84820100 10 C1CF507F2B48CAEA7FFA4D851F5C0B1D
  A&lt;&lt; (0000+2) (86ms) 9000
  A&gt;&gt; T=0 (4+0008) 04E00000 08 08C1F21746AB8A16
  A&lt;&lt; (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=*) -&gt; 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&gt;&gt; T=0 (4+0000) 00A40400 00
  A&lt;&lt; (0018+2) (55ms) 6F108408A000000003000000A5049F6501FF 9000
  Auto-detected ISD AID: A000000003000000
  A&gt;&gt; T=0 (4+0008) 80500000 08 1B81F8C4D44CC86A
  A&lt;&lt; (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&gt;&gt; T=0 (4+0016) 84820100 10 14C22B8CE836A4D4C2F1C20A8CD56F8C
  A&lt;&lt; (0000+2) (85ms) 9000
  A&gt;&gt; T=0 (4+0018) 04E00000 12 003400010101FFFF0080B9174FA320EEC470
  A&lt;&lt; (0000+2) (24ms) 6E00
  SCardEndTransaction()
  SCardDisconnect("ACS CCID USB Reader 0", false)
  
  GP:
  </code></pre>
  
  <p>Why I can't create my desired file?</p>