title: Chip EMV - Getting AFL for every smart card
body: <p>Continue from: <a href="https://stackoverflow.com/questions/50104424/emv-reading-pan-code">EMV Reading PAN Code</a></p>
  
  <p>I'm working in C, so I havn't Java tools and all the functions that parse automatically the response of APDU command.
  I want to read all types of smart cards. 
  I have to parse the response of an GET PROCESSING OPTIONS and get the AFL (Access File Locator) of every card.</p>
  
  <p>I have three cards with three different situation:</p>
  
  <ul>
  <li>A) HelloBank: <code>77 12 82 2 38 0 94 c 10 2 4 1 18 1 1 0 20 1 1 0 90</code> </li>
  <li>B) PayPal: <code>77 12 82 2 39 0 94 c 18 1 1 0 20 1 1 0 28 1 3 1 90</code></li>
  <li>C) PostePay: <code>80 a 1c 0 8 1 1 0 18 1 2 0 90</code> </li>
  </ul>
  
  <p>Case A) </p>
  
  <p>I've got three different AFL: <code>10 2 4 1</code>, <code>18 1 1 0</code>, <code>20 1 1 0</code>
  So I send <code>00 B2 SFI P2 00</code> where SFI was 10>>3 (10 was first byte of first AFL) and P2 was SFI&lt;&lt;3|4 and this way I got the correct PAN Code of my card.</p>
  
  <p>Case B) </p>
  
  <p>I've got three different AFL: <code>18 1 1 0</code>, <code>20 1 1 0</code>, <code>28 1 3 1</code>.
  So I send <code>00 B2 SFI P2 00</code> builded in the same way as Case A, but I got the response 6A 83 for every AFL.</p>
  
  <p>Case C)
  I've got two different AFL: <code>8 1 1 0</code>, <code>18 1 2 0</code> but I cannot parse those automatically because there isn't the same TAG of previous response.
  If I use those AFL it worked and I can get the PAN Code of the card.</p>
  
  <p>How can I make an universal way to read the correct AFL and how can I make the correct command with those AFL?</p>