I recently bought myself a smart-card reader in order to fool around with the MyKAD (Malaysian National Identity Card). The main reason for this is to figure out how to read the information contained within the MyKAD. I went online to find myself an OpenSC compatible reader and got myself one for just under RM 23. Next, I found some information about MyKAD APDU on a Lowyat forum along with the associated data file offsets.
The result is the following shell script that dumps all the MyKAD information onto the screen. OpenSC automatically detects the MyKAD as an EMV compatible card.
#!/bin/sh
AP_JPN="00:A4:04:00:0A:A0:00:00:00:74:4A:50:4E:00:10"
DF_PAGE1="C8:32:00:00:05:08:00:00:A0:00"
PR_PAGE1="CC:00:00:00:08:01:00:01:00:E9:00:A0:00"
SZ_PAGE1="CC:06:00:00:A0"
DF_PAGE4="C8:32:00:00:05:08:00:00:90:00"
PR_PAGE4="CC:00:00:00:08:04:00:01:00:03:00:90:00"
SZ_PAGE4="CC:06:00:00:90"
opensc-tool -v -s $AP_JPN \
-s $DF_PAGE1 -s $PR_PAGE1 -s $SZ_PAGE1 \
-s $DF_PAGE4 -s $PR_PAGE4 -s $SZ_PAGE4 2>/dev/null
All it took was 8 lines of shell script and it would dump all the MyKAD information onto the screen, raw. All that is needed now is some extra processing magic to slice up the data into its constituent parts. Imagine, all this without a single like of C/C++ code and under RM25!