title: Verify the PIN code of a belgian EID card on a reader with PINPAD
body: <p>All my attemps to verify a PIN code on a PINPAD reader ends up in failure, here is my situation:</p>
  
  <h2>Setup</h2>
  
  <ul>
  <li>Belgian EID card;</li>
  <li>Vasco DIGIPASS 875, connected in Bluetooth;</li>
  <li>Android application using the SDK from Vasco.</li>
  </ul>
  
  <h2>Situation</h2>
  
  <p>I've used APDU command to select and read files, to set the secure environment (MSE : SET), and after numerous research and merging of different solutions from different documentation, I can make the reader ask for my PIN code. But with my pseudo-APDU command, I receive a 69|C# response. The same process (reading files, set secure environment and verify the PIN) works fine on a USB reader with no PINPAD, so I guess that the APDU command is ok, but not the pseudo-APDU command that precedes.</p>
  
  <h2>Documentation used</h2>
  
  <p><a href="http://www.foo.be/eID/opensc-belgium/BEID-ReaderSpecs-v2.7.5.pdf" rel="nofollow">The BEID documentation</a>, PC/SC Spec part 10 (2.5.2) and supplement (2.2.1) and <a href="http://www.usb.org/developers/docs/devclass_docs/DWG_Smart-Card_CCID_Rev110.pdf" rel="nofollow">USB Smart Card devices</a> for chapter from 6.1.11.3 to 6.1.11.6.</p>
  
  <h2>What did I understand?</h2>
  
  <p>The first part should be <code>FF C2 01 06</code> for direct PIN verification on reader, followed by the size of the subsequent data.
   Next should follow the structure from PC/SC part 10, with:</p>
  
  <ol>
  <li>Timeout 1 &amp; 2 (<code>00</code> for default);</li>
  <li>Format (should be <code>89</code> for me, as it should be <code>10001001</code> for 1 byte offset PIN, justified left and BCD);</li>
  <li>PIN block format (should be <code>48</code> because 4 bit length included and 8 byte for the PIN block);</li>
  <li>PIN length format (<code>04</code>: 4 bit offset in the PIN block);</li>
  <li>Min/Max PIN length : <code>040C</code> (but didn't work like that, <code>0404</code> is sure to work);</li>
  <li>Validation condition is <code>02</code> for ok button;</li>
  <li>Number of messages : <code>01</code> to use the one in the command;</li>
  <li>Language is <code>0409</code> for english;</li>
  <li>Message to display is <code>00</code> for enter PIN;</li>
  <li><code>000000</code> because this field isn't used;</li>
  <li>The length of the final APDU command to transmit once formatted with the PIN (<code>0000000D</code> is my guess);</li>
  <li>And then the APDU command : <code>0020000108FFFFFFFFFFFFFFFF</code></li>
  </ol>
  
  <h2>Results</h2>
  
  <p>I have changed several times some values that I wasn't so sure (2, 3, 4, 11 and 12 for the padding characters already present or not), with no success, just different result codes sometimes.</p>
  
  <p>What do I do wrong here ?</p>
  
  <p>Thx in advance !</p>