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.
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

Hi, Nic, thanks for sharing this information. I’ve been doing some related work with this device: BIP-1300 http://www.mypidion.com/
Have you or any of your readers done something with the EMV class for this device?
I can only read App AID and Label (Mastercard) but not cardholder name nor tack2 data etc.
Thanks in advance!
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.
I would like to get the data from EMV card and encode it in magnetic card, I am not sure which application will help me, could you please help me?
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.
Hi, I wanted to know which program to use to read and write smart cards with chips?
THANKS
Very interesting program, Can you give us a link to download the source code?
Thanks!
Hi, thanks for your interest, unfortunately the source code is not currently available.
Can I have this program for Windows XP SP3?
Hi John, the source code for this program is now available on Github, unfortunately I don’t currently have the time to compile and test for Windows XP, but you are welcome to try it for yourself.
Hi Nic,
Your source is very helpful since currently I also doing some software for EMV card reading, but I have a problem :
1. I have successfully read my unused credit card ( Master card ), when I read the record based on AFL:
70 : READ RECORD Response Message Data Field
81 : Length
87 : (?)
5F25 : Application Effective Date
03 : Length
09 05 11 : 11 May 2009
5F24 : Application Expiration Date
03 : Length
14 06 30 : 30 June 2014
When I search the EMV docs, I could not find the template that has ’87′ ( above with question mark ).
Could you help me on this ?
Best regards
Hi Ery,
It’s some time since I’ve looked at EMV, but tag 87 is the Application Priority Indicator, however I would only expect to see this within a 61 or A5 template and not a 70 template. I hope this information helps.
Hi Nic,
Yes, I have read the spec also like that, and if I use the tools from http://www.emvlab.org/ it seems that Byte is ignored.
Do you know any people that also doing this kind of software ? or may be forums to discuss this ?
Best regards
Hi Nic,
At last I figure it out the problem :
70 : READ RECORD Response Message Data Field
81 : Length
87 : (?)
Based on ISO 7816-6 on Data Object Structure
if the Length of Value is > 127 then the second byte is ’81′….
Best Regards
Glad you figured it out and thanks a lot for sharing the solution here.
hello
Does it work to install a blank card, information
how to make a copy of the original?
Hello Nic
Add a write feature to this program could not be
and a blank card so you can install
and it works with this card as the original
Have you tried it?
This program looks very interesting
please Jump to contact us
We are able to produce a project
best regards
novartis001@hotmail.com