How to read serial number of a Gemalto smart card?

Shinichi picture Shinichi · Jul 24, 2013 · Viewed 7.7k times · Source

I have smart card and reader (Gemalto). I want to read serial number of card using C#. I read documents / libraries on Gemalto Support Site but there are no information useful for me.

I hope someone have exp about Gemalto help me some examples !

Thanks so much !

Answer

Nimish picture Nimish · Jul 26, 2013

You have to send APDU to smart card asking for card product life cycle data i.e (CPLC data).
Some specific types of cards have Card Production Life Cycle (CPLC) data. For example, JCOP cards have this at GET DATA or GETCPLCDATA at 0x9F7F tag or 0x0101 tag. I believe This is a Global Platform specific tag. Find what specification your card support. For Gemalto card, I hope it will work. Data what i got from my gemalto card by querying CPLC data is:

For 0x9F7F:

IC Fabricator :2 Bytes
IC Type : 2 Bytes
Operating System ID : 2 Bytes
Operating System release date : 2 Bytes
Operating System release level : 2 Bytes
IC Fabrication Date : 2 Bytes (Y DDD) date in that year
IC Serial Number : 4 Bytes
IC Batch Identifier : 2 Bytes
IC Module Fabricator : 2 Bytes
IC Module Packaging Date :  2 Bytes
ICC Manufacturer : 2 Bytes
IC Embedding Date :2 Bytes
IC Pre-Personalizer : 2 Bytes
IC Pre-Perso. Equipment Date : 2 Bytes
IC Pre-Perso. Equipment ID : 4 Bytes
IC Personalizer : 4 Bytes
IC Personalization Date : 2 Bytes
IC Perso. Equipment ID : 4 Bytes

For 0x0101:

Card serial number: 8 bytes  
Reserved bytes: 3 bytes 0
Flow identification: 1 byte  
Reserved bytes: 4 bytes 

Sorry i cant provide exact bytes and it might vary in your case. just check for what tag your card support. and Better refer to Global Platform documentation and ISO 7816 standard (http://www.ttfn.net/techno/smartcards/iso7816_4.html). I hope This is what you are looking for.