Lowyat.NET Forums

Welcome Guest ( Log In | Register )

LYN wins Intel-Lenovo-Tangs Blogathon challenge. Thank you everybody!
3 Pages < 1 2 3 > 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> MyKad Application, Need to capture data, how?

razinq
post Nov 3 2006, 04:44 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #21


Newbie
*

Group: New Member
Posts: 4
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2005





QUOTE(xenon @ Oct 24 2006, 10:25 PM)
Ok. I don't have time to complete my original MyKad reader program. Having difficulties with the dreaded user interface hell. So tonight I work on a quick-and-dirty console application in C. You need to use a hex editor to look at the output dump file. But, the basic information like name, IC no., are printed in the console too.

Not responsible if got damage  blush.gif
Fail? Success? report here.
*



Xenon ... good laa you ... ive download your program and it works with my rm50 reader rclxms.gif Thanks alot ...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
razinq
post Nov 3 2006, 04:46 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #22


Newbie
*

Group: New Member
Posts: 4
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2005





QUOTE(xenon @ Oct 24 2006, 10:25 PM)
Ok. I don't have time to complete my original MyKad reader program. Having difficulties with the dreaded user interface hell. So tonight I work on a quick-and-dirty console application in C. You need to use a hex editor to look at the output dump file. But, the basic information like name, IC no., are printed in the console too.

Not responsible if got damage  blush.gif
Fail? Success? report here.
*



Xenon ... good laa you ... ive download your program and it works with my rm50 reader rclxms.gif Thanks alot ...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
razinq
post Nov 3 2006, 04:49 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #23


Newbie
*

Group: New Member
Posts: 4
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2005





Xenon
Ive download ur program, and it work with my rm50 reader rclxms.gif ... thanks buddy ...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
xenon
post Apr 13 2007, 10:15 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #24


On my way
****

Group: Senior Member
Posts: 500
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2005
From: Selangor





A few forumers asked me questions regarding reading of MyKad surface information. The answer is there is no encryption; it is just about knowing what (APDU) command to send.

There will be 5 APDU commands that I'll introduce. I name them as
1) Select Application
2) Get Response
3) Set Length
4) Select Info
5) Read Info

Instead of viewing a particular command to read "Name", another command to read "IC no.", it is better to interpret a sequence of 3 commands (Set Length, Select Info, Read Info) as "reading a section (or the whole) file". The fact is "Name", "IC no." etc are stored in fixed-length fields (padded on the right), and concatenated together (without separator) to form files.
For example,
"Name" stored in file jpn-1-1, offset 0x00E9, length 0x28
"IC no." stored in file jpn-1-1, offset 0x0111, length 0x0D
When you want to read "Name", you read jpn-1-1, offset 0x00E9, length 0x28.
When you want to read "IC no.", you read jpn-1-1, offset 0x0111, length 0x0D.
When you want to read both "Name" and "IC no.", you read jpn-1-1, offset 0x00E9, length 0x35.
Conversely, you can read only part of the field; if you want only first 6 digits of "IC no.", read jpn-1-1, offset 0x111, length 6.

Now, the first 2 commands, "Select Application" and "Get Response", are used to select either one of JPN, JPJ, IMM appplication. (Actually you can have 2 active at the same time by using logical channels, but that's a little bit advanced at this stage.) You must select an application after reset, and you'll do it only once except you want to change application.

Reader: 00 A4 04 00 0A A0 00 00 00 74 4A 50 4E 00 10 (Send 10 bytes data, expect receive 0 bytes)
Card : 61 05
Reader: 00 C0 00 00 05 (Send 0 bytes data, expect receive 5 bytes)
Card : 6F 03 82 01 38 90 00

"00 A4 04 00 0A" is the "CLA INS P1 P2 P3" for "Select Application". The data part of the APDU consists of 10 bytes: "A0 00 00 00 74 4A 50 4E 00 10". The "A0 00 00 00 74" and "00 10" parts are constant. "4A 50 4E" represents "JPN". Change to "JPJ" or "IMM" for those applications.
"00 C0 00 00 05" is the "CLA INS P1 P2 P3" for "Get Response". The 5 data bytes received is not significant, but you can verify whether it is successful.

That's the end of description of "Select Application" and "Get Response". Now move on to the 3 commands to read a section of file.

Example: read jpn-1-1, offset 0x00E9, length 0x28.
Reader: C8 32 00 00 05 08 00 00 28 00
Card : 91 08
Reader: CC 00 00 00 08 01 00 01 00 E9 00 28 00
Card : 94 28
Reader: CC 06 00 00 28
Card : 4D 59 20 4E 41 4D 45 20 20 20 20... 90 00

The 3 commands "Set Length", "Select Info", and "Read Info" are shown above. The colored parts are those which varies.
It seems from above that the maximum length will be 0xFF, so you'll have to break long file section (particularly when reading JPEG) into multiple reads (repeat the 3 commands with different length and offset). But actually, for advanced users, you can specify a length >= 0x0100, (provided you don't read past the end of file which results in no bytes returned,) in the "Set Length" and "Select Info". You only need multiple "Read Info", with the single byte length set to big a number (eg. 0xFF or 0xFC), except the last read. "Read Info" is just like retrieving out from a FIFO buffer, you can read however you want, but don't over-read it.

To read jpn-1-4, replace 01 00 01 00 to 04 00 01 00.

Those double byte "Offset" and "Length" are in little endian.

Tables
» Click to show Spoiler - click again to hide... «


» Click to show Spoiler - click again to hide... «


» Click to show Spoiler - click again to hide... «


Data types
» Click to show Spoiler - click again to hide... «
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
waykeong
post Apr 17 2007, 11:44 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #25


Newbie
*

Group: Junior Member
Posts: 30
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2005




Thanks for your guide. Btw, What those bytes received from card imply?

Reader: 00 A4 04 00 0A A0 00 00 00 74 4A 50 4E 00 10 (Send 10 bytes data, expect receive 0 bytes)
Card : 61 05
Reader: 00 C0 00 00 05 (Send 0 bytes data, expect receive 5 bytes)
Card : 6F 03 82 01 38 90 00

Reader: C8 32 00 00 05 08 00 00 28 00
Card : 91 08
Reader: CC 00 00 00 08 01 00 01 00 E9 00 28 00
Card : 94 28
Reader: CC 06 00 00 28
Card : 4D 59 20 4E 41 4D 45 20 20 20 20... 90 00
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
xenon
post Apr 17 2007, 12:22 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #26


On my way
****

Group: Senior Member
Posts: 500
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2005
From: Selangor





I don't know. We can just guess. It is not required to know exactly what it means. Just know that what bytes should appear under no-error condition.

If you read ISO7816-3, you should know a little about SW1-SW2. A "90 00" generally means success.

Card : 61 05
This is the SW1-SW2. Probably means there are 5 bytes to be read using Get Response.

Card : 6F 03 82 01 38 90 00
"6F 03 82 01 38" is the 5 byte data. No idea what it means, seems to be constant for several cards I tested. "90 00" is SW1-SW2.

Card : 91 08
SW1-SW2. You can guess that it is expecting you to send 8 bytes data using the "CC 00 00 00 08" command.

Card : 94 28
SW1-SW2. Perhaps it means 28 bytes is ready in buffer. Proceed to use "CC 06 00 00 28"

Card : 4D 59 20 4E 41 4D 45 20 20 20 20... 90 00
Except the last 2 bytes which are the SW1-SW2, the 28 (hex) bytes are the data you just read. It is ISO8859/Windows charset/UTF8 text in this case. This is the data (the section of a file) that you wish to read. In this example, you read the name, "MY NAME".

This post has been edited by xenon: Apr 17 2007, 12:32 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
stormchaser
post Apr 17 2007, 02:19 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #27


love your neighbour, help serve society
****

Group: Senior Member
Posts: 568
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003
From: far beyond lands..... Expired : Jan 2020




Reading data from MyKad is ok but if u need to write to Mykad or modify u need to have license. If u use your sdk to do illegal stuff, u will kena.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Ee_
post Apr 19 2007, 06:44 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #28


Mehh
*****

Group: Senior Member
Posts: 790
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Sep 2004
From: Aurora






Woo.. MyKad APDU.. I think this is the first time I saw one on the internet. Thanks a lot to Xenon laugh.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
waykeong
post Apr 20 2007, 09:35 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #29


Newbie
*

Group: Junior Member
Posts: 30
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2005




wonder how i can code those APDU commands using VB.net?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
keith_hjinhoh
post Apr 21 2007, 10:47 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #30


Need My Service?
*******

Group: Senior Member
Posts: 2,180
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Nov 2004




QUOTE(stormchaser @ Apr 17 2007, 02:19 PM)
Reading data from MyKad is ok but if u need to write to Mykad or modify u need to have license.  If u use your sdk to do illegal stuff, u will kena.
*


I dun think the reader that sell to our consumer has the ability to write data into mykad.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
hungheykwun
post Apr 25 2007, 11:16 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #31


Enthusiast
*****

Group: Senior Member
Posts: 865
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Sep 2005
From: Puchong





u cant write to mykad even if u try. and if u try 3 times unsuccessfully, yr card will be blocked (cant read/write anymore)

to write, u need another perso card that only JPN has. and even if u have that , u would need the pin which is protected by a triple des encryption.

where can i buy a smart card reader & get some sample cards?

This post has been edited by hungheykwun: Apr 25 2007, 11:17 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Diligent Sloth
post Apr 25 2007, 11:32 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #32


Lowyat VPN provider
*****

Group: Senior Member
Posts: 880
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jul 2006
From: Sibu, Sarawak






I have yet to try modifying mykad data, perhaps one day I'll try.. (report my IC as missing and get a new one reissued).

I've still got an old smartcard writer back from the good 'ol days before astro changes to SECA2 sad.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
hanazku
post Oct 2 2007, 02:05 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #33


Newbie
*

Group: New Member
Posts: 2
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Aug 2007




hi i may be out of date to reply to you guys but i realy need your help esp xenon. u rock.. smile.gif

xenon u think u can develop a program using visual basic to retrieve mykad information? btw i bought my smart card reader (ACR30U). u thing this device works on your C program?

pls reply. msg me. @ email me: hanazku@yahoo.com

thanx
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
xenon
post Oct 2 2007, 07:38 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #34


On my way
****

Group: Senior Member
Posts: 500
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2005
From: Selangor





All readers that are PC/SC compliant and get listed by Windows API SCardListReaders() will work.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
KLKS
post Oct 2 2007, 08:55 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #35


Getting Started
**

Group: Junior Member
Posts: 277
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003
From: Kuala Lumpur Malaysia





ever think of making an open-sourced SDK for people to use for free? would make for a good community project
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
cybpsych
post Dec 12 2007, 11:07 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #36


---------------------
*******

Group: Senior Member
Posts: 4,980
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003




open-source SDK is not recommended as the MyKad commands is a property of Malaysian Government.

I've tried IRIS' SCR21U reader with SDK ... it works fine and able to output all public info from MyKad into my app.

maybe you should give IRIS a call wink.gif

Contact: 03-89960788
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
ling13140
post Dec 20 2007, 03:26 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #37


Getting Started
**

Group: Junior Member
Posts: 85
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2007




can like this one ah?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
LSG
post Jan 8 2008, 05:44 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #38


Newbie
*

Group: Junior Member
Posts: 33
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003





QUOTE(xenon @ Oct 24 2006, 10:25 PM)
Ok. I don't have time to complete my original MyKad reader program. Having difficulties with the dreaded user interface hell. So tonight I work on a quick-and-dirty console application in C. You need to use a hex editor to look at the output dump file. But, the basic information like name, IC no., are printed in the console too.

Not responsible if got damage  blush.gif
Fail? Success? report here.

Two files in attachment unpack into the same files.
save the ".txt" as .zip.
*



hey can u send it to me? i cant seem to download it.

lsg.theoneandonly@gmail.com

thx
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
feiming
post Jan 9 2008, 12:15 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #39


Getting Started
**

Group: Junior Member
Posts: 171
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003
From: Segamat Currently:Melaka




QUOTE(cybpsych @ Dec 12 2007, 11:07 AM)
open-source SDK is not recommended as the MyKad commands is a property of Malaysian Government.

I've tried IRIS' SCR21U reader with SDK ... it works fine and able to output all public info from MyKad into my app.

maybe you should give IRIS a call wink.gif

Contact: 03-89960788
*


who owns the goverment??
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
LSG
post Jan 9 2008, 02:45 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #40


Newbie
*

Group: Junior Member
Posts: 33
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003





QUOTE(xenon @ Oct 24 2006, 10:25 PM)
Ok. I don't have time to complete my original MyKad reader program. Having difficulties with the dreaded user interface hell. So tonight I work on a quick-and-dirty console application in C. You need to use a hex editor to look at the output dump file. But, the basic information like name, IC no., are printed in the console too.

Not responsible if got damage  blush.gif
Fail? Success? report here.

Two files in attachment unpack into the same files.
save the ".txt" as .zip.
*



works like a charm! kudos xenon!
note: i renamed scdump.exe.ren to scdump.exe
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

3 Pages < 1 2 3 >
Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 23rd November 2009 - 01:43 AM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)