Welcome Guest ( Log In | Register )


5 Pages < 1 2 3 4 > » Bottom
Bump Topic Add Reply RSS Feed New Topic New Poll

Outline · [ Standard ] · Linear+

> MyKad Application, Need to capture data, how?

views
     
razinq
post Nov 3 2006, 04:44 PM

New Member
*
Group: Junior Member
Posts: 4

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 ...
razinq
post Nov 3 2006, 04:46 PM

New Member
*
Group: Junior Member
Posts: 4

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 ...
razinq
post Nov 3 2006, 04:49 PM

New Member
*
Group: Junior Member
Posts: 4

Joined: Dec 2005


Xenon
Ive download ur program, and it work with my rm50 reader rclxms.gif ... thanks buddy ...
xenon
post Apr 13 2007, 10:15 AM

On my way
****
Group: Senior Member
Posts: 501

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... «

waykeong
post Apr 17 2007, 11:44 AM

New Member
*
Group: Junior Member
Posts: 34

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
xenon
post Apr 17 2007, 12:22 PM

On my way
****
Group: Senior Member
Posts: 501

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
stormchaser
post Apr 17 2007, 02:19 PM

love your neighbour, help serve society
****
Group: Senior Member
Posts: 586

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.
Ee_
post Apr 19 2007, 06:44 PM

Mehh
*****
Group: Senior Member
Posts: 852

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
waykeong
post Apr 20 2007, 09:35 PM

New Member
*
Group: Junior Member
Posts: 34

Joined: Feb 2005
wonder how i can code those APDU commands using VB.net?
keith_hjinhoh
post Apr 21 2007, 10:47 AM

Need My Service?
*******
Group: Senior Member
Posts: 2,643

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.
hungheykwun
post Apr 25 2007, 11:16 AM

Enthusiast
*****
Group: Senior Member
Posts: 983

Joined: Sep 2005
From: Subang


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
Diligent Sloth
post Apr 25 2007, 11:32 AM

Lowyat VPN provider
*****
Group: Senior Member
Posts: 880

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
hanazku
post Oct 2 2007, 02:05 PM

New Member
*
Group: Newbie
Posts: 2

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
xenon
post Oct 2 2007, 07:38 PM

On my way
****
Group: Senior Member
Posts: 501

Joined: Jan 2005
From: Selangor

All readers that are PC/SC compliant and get listed by Windows API SCardListReaders() will work.
KLKS
post Oct 2 2007, 08:55 PM

Getting Started
**
Group: Junior Member
Posts: 286

Joined: Jan 2003


ever think of making an open-sourced SDK for people to use for free? would make for a good community project
cybpsych
post Dec 12 2007, 11:07 AM

---------------------
*********
Group: All Stars
Posts: 45,270

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
ling13140
post Dec 20 2007, 03:26 PM

Getting Started
**
Group: Junior Member
Posts: 85

Joined: Dec 2007
can like this one ah?
LSG
post Jan 8 2008, 05:44 PM

New Member
*
Group: Junior Member
Posts: 41

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
feiming
post Jan 9 2008, 12:15 AM

Getting Started
**
Group: Junior Member
Posts: 212

Joined: Jan 2003
From: KL


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??
LSG
post Jan 9 2008, 02:45 PM

New Member
*
Group: Junior Member
Posts: 41

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

5 Pages < 1 2 3 4 > » Top


Bump Topic Add ReplyOptions New Topic
 

Switch to:
| Lo-Fi Version
0.0993sec    2.83    6 queries    GZIP Disabled
Time is now: 20th June 2019 - 12:44 AM