Reading ID Card Data in Ubuntu with EZ100PU Smart Card Reader (Thai ID Edition)

I was asked help with configuring a smart card reader on a government computer running Windows 7, but this made me wonder what would happen if I connected the card reader to my Ubuntu laptop and whether I’d be able to read content from a Thai ID card.

EZ100PU Smart Card Reader

Let’s have a look at the card reader itself first.

Fast ID EZ100PU ISO7816 Smart Card Reader

It’s a FAST ID EZ100PU smart card reader compliant with ISO7816 standard. That’s the product page of the specific model, but a search for EZ100PU only reveals the manufacturer may be InfoThink Technology based on Taiwan.

EZ100PU Smart Card Reader Driver CD

The USB smart card reader comes with a CD that includes drivers for Windows, Linux, Mac OS, and Android, as well as an SDK with a demo program and sample code in C++, Visual Basic .NET, and C#. As we’ll see further below, the Linux driver is not needed as it works out of the box.

Alcor Smart Card Reader PCB RX-N99B-2
Click to Enlarge

The design of the board (RX-N99B-2) is very simple with just the main chip:  Alcor AU9560 USB smart card controller. We can also see the area that interfaces with the smart card’s chip on the bottom left side of the PCB.

Smart Card SlotThe other side of the board just has a smart card slot.

Using the Smart Card Reader in Ubuntu 18.04

Let’s connect the reader to my laptop, and insert a Thai ID card (contact smart card).

Smart Card Reader Thai ID CardThe good news is that the smart card is automatically detected by the kernel as an EMV Smartcard Reader.


I needed to do a web search from here, and I found a post on Linuxmint explaining how to do based on an earlier post about Spanish ID cards.

We’ll need to install a few packages (note: not all may be needed but the important ones are pcscd and pcsc-tools):


Now we can run a scan on the card reader:


An Alcor Micro AU9560 is detected, and it somehow it detects Thai passport, possibly because the program used to create the card was misconfigured?

There are several other codes specifically for Thai ID cards in smartcard_list.txt. You may want to check that file to see all kind of card support.  Here are the ones with “Thai” string for reference:

Thai GSM UICC (Telecommunication)
Thai id card (Other)
Seven-Eleven Value Card / Smart Purse – Thailand (Other)
Thailand National ID (eID)
Thai National ID Card (eID)
Thai National ID Card (eID)
Thai (passport)
Truemove H Thailand (Telecommunication)
True Money Touch Sim (Thailand)
Seven-Eleven Value Card / Smart Purse – Thailand (Contactless) (Other)
Thai Passport 2010, 2011
Thai Passport 2005

Reading and Decoding Data from the ID Card

I can access the hardware with the reader and get the type of card. That’s all good, but it would be good to be able to access and decode the data inside the Thai ID card. Github’s user Bouroo wrote code to do just that in Python and NodeJS.

I’ll do that with the Python script. We first need to install some dependencies:


We can now run the script, and it will extract the data accordingly:


I removed personal data from the output, but everything was displayed properly in the console including name and address using the Thai language. The script will also save the photo stored inside the ID card using <CID>.jpg file name with CID being the Card IDentification number.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
3 Comments
oldest
newest
willy
willy
4 years ago

The “historical bytes” dump contains “54 48 20 4E 49 44 20 31 32” which is the hex representation of “TH NID 12” so it’ probably the string you have to put in the file to make it recognized as an ID card.

dgp
dgp
4 years ago

From the small amount of the card that’s visible the card looks a lot like my Japanese residence card. Maybe the same company makes the blanks? My card has an NFC tag in it though.

eigenfield
eigenfield
2 years ago

Is this a Java Card type?

Khadas VIM4 SBC