Reading MyKad in Windows
For my first post in this blog, I decided to give out an example application to read MyKad which is written in Java. This application has successfully read:
- Old and new IC number
- Name
- Sex
- Date of birth
- Birth place
- Nationality
- Race
- Religion
- Address
- Photo
Do take note that for the photo part, it is not completely bug free, I’ll fix it when I got time which may not be happening :) There are a few things that I need you take note first:
- Almost 70% codes of this application are not written by me. I’m merely putting pieces together from multiple references in order to read the MyKad.
- Main credit should be given to Xenon who somehow managed to reverse engineered MyKad APDU so that we can read it without needs to pay a single cent for the SDK.
- Don’t expect a perfect code here since it’s my first time writing Java codes after 3 years and I don’t see any needs to upgrade it, at least for now. But you can be sure that it’s working at the time of this post is written.
- Even though it’s written in Java, it can be a guide for you to write in your own favorite programming language.
- This application only reads data from Jabatan Pendaftaran Negara (JPN).
These are the system environments that I use to run this app:
- JDK 6 Update 2 (JDK 5 should be working just fine).
- Windows XP.
- Netbeans 5.5 (you may need to update the GUI Builder Pack to the beta version if you want to edit the GUI, however it’s recommended you use the latest version).
- A smart card reader, I use Athena (got Linux support). Other brand will do, just make sure the driver is installed correctly.
Follow these steps to read your first MyKad:
- First thing first, you need to download Windows binary of JPC/SC Java API.
- Get the Netbeans project file here.
- You must include jpcsc.jar as the library. You can get the file from Step 1.
- You must also put jpcsc.dll into your main project folder and if you want to distribute the application, you MUST put it together with your main jar file. You can also get it from Step 1.
- Plug in your reader.
- Run the application (either directly or from Netbeans).
- Insert your MyKad.
- Wait till the app finished reading it.
- A GUI will popup presenting your MyKad data.
- If no data is showing, it is possible that your MyKad chip is spoiled that is if you’ve done everything correctly. It will only take 14 days to get a new one.
If you have any question regarding the Java itself, you can ask in the comment section, but if you got question about the APDU commands, I suggest you read this post by Xenon, the explanations given are very detail. There’s also a simple application made by him to read MyKad written in C.
Screenshot of the interface:
![]()
Summarize links of all files in this post:
Stay tune for the Linux version :)
Update 1: Linux version is available here.
Update 2: Read MyKad using Visual Basic











OK.. Cun tq.. blh kasi aku coding utk vb 6 tak camne nak baca reader???
TQ
MasTerji
10 Jan 08 at 05:00 PM
Sorry, can’t help you on that, I don’t know VB at the moment, but maybe you can refer to Xenon Console App for a reference
amree
11 Jan 08 at 08:34 PM
UPDATE: Reading MyKad using Visual Basic
amree
28 May 08 at 12:35 AM
1. instead of doing this way, is there any possibilities invoke it using javascript?
2. how i’m going to include jpcsc.jar as the library?do i need to install netbeans?
sen
30 Jun 08 at 04:04 PM
@sen
You’ve to understand that Java is not the same as JavaScript. To implement MyKad reading using web based application, you might consider using Java Applet (google about it), however, the reader must be installed correctly at the client PC.
By the way, Netbeans is just an editor, just like Notepad. You don’t need it to run Java apps. But of course, you need at least Java Runtime Environment (JRE) to run Java application.
amree
1 Jul 08 at 02:57 PM
thanks a million amree.
i’d extend it to applet. however, my servlet seem can’t read the applet.
this error has occured:
and
why?can you help me fix this.
thanks
sen
2 Jul 08 at 07:18 AM
sorry, the error didnt display again :
classNotFoundException.sc.MainApplet.class
and
NoClassDefFoundException: com/linuxnet/jpcsc/PCSCException
thanks in advance..
thanks in advance
sen
3 Jul 08 at 10:12 AM
@sen
I’m not really sure about the error since I have no experience in creating applet. Maybe when I’m free, I’ll setup a demo using applet, till then, Google is your friend :) Good luck !
amree
4 Jul 08 at 06:39 PM
great! anyway how can i display the thumb print?
aizul
12 Sep 08 at 11:15 AM
@aizul
Sorry, haven’t venture much into the thumb print things, if I did, I’ll post the information :)
amree
12 Sep 08 at 05:36 PM
it’s ok. i am trying to do it in an applet. i am stuck with the dll loading.
aizul
14 Sep 08 at 02:47 AM
It’s no exageration! Your programme using VB is simply wonderful. You get to capture the info and the image beautifully well using ACS card reader. It is not just VB (Visual Basic) but VBVB, VB (Very Best) VB (Visual Basic). Thanks to you and Xenon. Is there a way of bringing in your creation to other database programme like Access to capture and save it to the database. I am no programmer. This will help a lot for associations and organizations to register delegates or participants with minimal manual effort.
Dr Ratna
15 Oct 08 at 02:48 PM
@Dr Ratna
Correction, the VB is not my program (it was Xenon’s), hence, I can’t be really helpful in Visual Basic department :) However, I’m not sure if it’s possible to ‘insert’ the program into Microsoft Access. But it’s definitely possible to create a program with Visual Studio and using Microsoft Access as the database.
amree
18 Oct 08 at 02:34 PM
Thanks for your reply. As I have informed, I am no programmer. Can Xenon be of help?
Dr Ratna
20 Oct 08 at 06:32 PM
@Dr Ratna
Please check your email for Xenon’s contact.
amree
20 Oct 08 at 08:13 PM
cool
dota
27 Feb 09 at 04:16 AM
Hello amree, what does this mean?
dota
22 Mar 09 at 05:52 PM
@dota
Check your email
amree
24 Mar 09 at 09:00 AM
Is This Just For Fun
danial
10 Apr 09 at 11:18 AM
Sorry, i also face same problem :-
NoClassDefFoundException: com/linuxnet/jpcsc/PCSCException
can you help me, Thanks
ahfei
17 Jun 09 at 09:40 AM
@ahfel
You need to link jpcsc library correctly into your project
amree
25 Jun 09 at 02:15 PM
Hi amree.
As u have given in the det I have downloaded JPC/SC Java API, and added the library jpcsc.jar and its reference DLL jpcsc.dll.The code is executing without any exceptions and initializing the reader and returning the Reader Name : Cardman OMNIKEY 5×21 0 but in next step GetStatusChange its going inside the loop and the condition is not satisfying to come out.
Am using the OMNIKEY 5321 Reader and Mifare 1k Card.
can u plz give me some solution for this.
Anoop
6 Aug 09 at 01:37 PM
How can I read mykas PKI?
what code should I use?
wan
24 Oct 09 at 03:37 PM
when will the finger print be available? because i have a project that requires to do finger print verification from mykad.
raption83
14 Jan 10 at 02:13 PM
Hi amree,
I do have this error:0x8010002e,Cannot find a smart card reader.
Any idea?
Many Thanks.
JavaNoob
2 Jun 10 at 10:54 PM
@JavaNoob
It seems like your reader has not been detected yet. Make sure it’s in your Device Manager list. For my reader, if everything is OK, it will light up (meaning it’s ready to be used). Maybe you should install driver or something.
amree
8 Jun 10 at 11:48 AM
Hi amree,
Ya, it’s detected as – CP210x USB to UART Bridge Controller in Device Manager. It should be fine theoretically. hmm….
JavaNoob
11 Jun 10 at 12:42 AM