EMV Card Browser

For a little while now I have been working on a utility to allow you to query and view the contents of the chip on your Chip & PIN / EMV smart card.

I’ve been working in .net which meant lots of P/Invoke calls to the Microsoft Smartcard API’s to access the PC/SC reader hardware. There were a few samples out there and http://www.pinvoke.net/ is always a great resource, but most of the P/Invoke implementations had problems in one way or another, notably using Int rather than IntPtr which meant things didn’t work correctly on 64 bit windows. :(

Anyway after a while I managed to create a PCSC interop assembly that allowed me to communicate with my smart card reader correctly in both 32 bit and 64 bit Windows.

Next I had to read through my copies of the EMVCo and ISO 7816 specs and figure out exactly what calls I had to make through my PCSC interop assembly to get all the information. Needless to say I’ve been keeping busy in my spare time. :)

EMV Card Browser

Once a card has been read, the results can be saved off into an XML file which looks something like this

<?xml version="1.0" encoding="utf-8"?>
<card>
  <application aid="315041592E5359532E4444463031">
    <fileControlInformation>
      <tlv tag="6F" length="36" value="840E315041592E5359532E4444463031A512880101BF0C0CC50AFFFF3F00000003FFFF03" description="FCI Template">
        <tlv tag="84" length="14" value="315041592E5359532E4444463031" description="Dedicated File (DF) Name" />
        <tlv tag="A5" length="18" value="880101BF0C0CC50AFFFF3F00000003FFFF03" description="FCI Proprietary Template">
          <tlv tag="88" length="1" value="01" description="Short File Identifier (SFI)" />
          <tlv tag="BF0C" length="12" value="C50AFFFF3F00000003FFFF03" description="FCI Discretionary Data">
            <tlv tag="C5" length="10" value="FFFF3F00000003FFFF03" description="" />
          </tlv>
        </tlv>
      </tlv>
    </fileControlInformation>
    <elementaryFile sfi="1">
      <record number="1">
        <tlv tag="70" length="31" value="611D4F06A00000002401501053656C66205365727669636520202020870101" description="Application Elementary File (AEF) Data Template">
          <tlv tag="61" length="29" value="4F06A00000002401501053656C66205365727669636520202020870101" description="Application Template">
            <tlv tag="4F" length="6" value="A00000002401" description="Application Identifier" />
            <tlv tag="50" length="16" value="53656C66205365727669636520202020" description="Application Label" />
            <tlv tag="87" length="1" value="01" description="Application Priority Indicator" />
          </tlv>
        </tlv>
      </record>
      <record number="2">
        <tlv tag="70" length="32" value="611E4F07A000000029101050104C696E6B202020202020202020202020870102" description="Application Elementary File (AEF) Data Template">
          <tlv tag="61" length="30" value="4F07A000000029101050104C696E6B202020202020202020202020870102" description="Application Template">
            <tlv tag="4F" length="7" value="A0000000291010" description="Application Identifier" />
            <tlv tag="50" length="16" value="4C696E6B202020202020202020202020" description="Application Label" />
            <tlv tag="87" length="1" value="02" description="Application Priority Indicator" />
          </tlv>
        </tlv>
      </record>
      <record number="3">
        <tlv tag="70" length="32" value="611E4F07A0000000031010501056697361202020202020202020202020870103" description="Application Elementary File (AEF) Data Template">
          <tlv tag="61" length="30" value="4F07A0000000031010501056697361202020202020202020202020870103" description="Application Template">
            <tlv tag="4F" length="7" value="A0000000031010" description="Application Identifier" />
            <tlv tag="50" length="16" value="56697361202020202020202020202020" description="Application Label" />
            <tlv tag="87" length="1" value="03" description="Application Priority Indicator" />
          </tlv>
        </tlv>
      </record>
      <record number="4">
        <tlv tag="70" length="32" value="611E4F07A00000000380025010566973612052656D2041757468656E20870104" description="Application Elementary File (AEF) Data Template">
          <tlv tag="61" length="30" value="4F07A00000000380025010566973612052656D2041757468656E20870104" description="Application Template">
            <tlv tag="4F" length="7" value="A0000000038002" description="Application Identifier" />
            <tlv tag="50" length="16" value="566973612052656D2041757468656E20" description="Application Label" />
            <tlv tag="87" length="1" value="04" description="Application Priority Indicator" />
          </tlv>
        </tlv>
      </record>
    </elementaryFile>
  </application>
</card>

If you have got a PC/SC compliant device in your PC and you are running Windows Vista or later and want to have a play the install package can be found here.

History

•0.0.1-First public release

4 Responses to “EMV Card Browser”


  • i am studying how emv chip and pin cards work and i would like to know how you can encode the Track 1 2 3 from the magnetic stripe onto the emv chip
    thank you

  • According to EMVCo Book3, Track 1 Discretionary Data is encoded in tag 0x9F1F, Track 2 Discretionary Data is encoded in tag 0x9F20 and Track 2 Equivalent Data is encoded in tag 0×57.

  • the issue im facing is that the softwae does not recognise the card… it basically hangs when i try to read a card.
    Im running Windows Vista Business sp2, on .net framework 3.5 sp1, ACR30U, and a gemalto smart card.

    Any advises or workaround?

  • Figured out the issue.. The USB Card Reader driver default by windows update may no be suitable at some times, tried downloading the driver from the original provider’s website and it worked like charm.

Leave a Reply