APDU Command to read card number

JuanD picture JuanD · Feb 13, 2013 · Viewed 37.5k times · Source

I would like to know if it's possible to get a Debit/Credit Card number from a SmartCard, I' trying to get it using a SmartCard reader with the communication protocol PC/SC,CCID and the card interface ISO/IEC 7816-1/2/3 SmartCard,MicroSD interface ISO 7816-4 SmartCard.

So far I just get the type of the card inserted (Visa, Mastercard, Maestro, etc.)

Thanks!

Answer

Carlos Mayoral picture Carlos Mayoral · Feb 17, 2013

First of all let me tell you that there isn't a easy way.

You have to look into the EMV documentation, this tutorial is pretty good.

http://www.openscdp.org/scripts/tutorial/emv/index.html

All the information in a Chip Card is in bytes, mostly coded in TLV. The card generally has multiple records where the information is stored, you have to loop that records to find the tag "5a" which is the one of the PAN.

Hope it helps.