Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APDU Command to read card number

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!

like image 365
JuanD Avatar asked Oct 18 '25 18:10

JuanD


2 Answers

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.

like image 162
Karu Ma Avatar answered Oct 20 '25 11:10

Karu Ma


The card number that you are talking about is the PAN = Primary Account Number

This data is contained in Track 1 and Track 2, as exposed here.

You can retrieve this data from chip via APDU commands. There is a step by setp on how to do that here.

like image 40
kdmin Avatar answered Oct 20 '25 12:10

kdmin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!