pikopong

it's all about knowledge

Reading MyKad using Visual Basic

with 19 comments

It seems that a lot of people asking how to read MyKad using Visual Basic, but since I don’t have the slightest idea on how to code in VB, I started to search around. To my surprise, Xenon (the one who reverse engineered MyKad to get the APDU) actually wrote a small application in VB to read MyKad. So, for those who can’t afford to buy SDK from commercial company, you can download the code here for FREE !

VB Application to read MyKad


View the discussion
Download the code

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • PDF
  • Print
  • Reddit
  • Slashdot
  • Technorati
  • Twitter

Related Posts

Written by amree

May 28th, 2008 at 12:32 am

Posted in programming

Tagged with , , ,

19 Responses to 'Reading MyKad using Visual Basic'

Subscribe to comments with RSS or TrackBack to 'Reading MyKad using Visual Basic'.

  1. Have you try program the MyKad reader to read passport, driving license, medical, biometric data?

    LeNo Gravatar

    8 Jun 08 at 02:29 PM

  2. This one is only for JPN. Others, not yet :)

    amreeNo Gravatar

    9 Jun 08 at 01:42 AM

  3. hi..

    i’ve already download the vb version..
    what confius me,how to read it on vb?or how to integrate it on vb?i’m typically very new in this programming field..can you kindly help me to figure it out?..thanks

    eddNo Gravatar

    17 Oct 08 at 02:16 AM

  4. @edd

    I’m sorry I can’t be much of a help in Visual Basic. As I said in my post, this is not my codes.

    However, my advice is that you actually don’t integrate this program into your code, you need to learn how to send APDU commands to your reader based on the codes.

    Read the code line by line if you have to. Then you’ll understand how it works and then you can create your own.

    amreeNo Gravatar

    18 Oct 08 at 02:22 PM

  5. When I try to run Scread.vbproj using visual studio.net 2003 an error appear. “The scread.vbproj is not a valid project file.The project file is missing the VisualStudioProject section.”

    jamesonNo Gravatar

    13 Aug 09 at 03:29 PM

  6. @jameson

    I’ve successfully loaded it in Visual Studio, I’m not sure about your problem since I’m not a Visual Studio user. Maybe you should try recreating the project ?

    amreeNo Gravatar

    16 Aug 09 at 11:22 AM

  7. hi..

    How to save the data in a database eg Ms Access? Can you give example because i want to read the data and save it in a database.is it possible? TQ

    neilNo Gravatar

    13 Nov 09 at 10:03 AM

  8. @neil

    I’m pretty sure a little googling will tell you on how to do that, besides, the main point of this post is about reading MyKad, not about database application. A little tip for you, the data from MyKad is just your usual data, so, saving them into database is not different from others.

    amreeNo Gravatar

    13 Nov 09 at 12:20 PM

  9. hi,

    I manage to save all the data to a MS Access database after several trial and error.Thanks a lot for the applications and especially to xenon for his code. tq

    neilNo Gravatar

    9 Dec 09 at 08:28 PM

  10. salam..anyone have visual basic code for mykad?

    meNo Gravatar

    13 Mar 10 at 03:28 PM

  11. Salam..

    Get the code from Lowyat, you’d have to be registered there to download it.

    amreeNo Gravatar

    13 Mar 10 at 03:37 PM

  12. thank bro.. the code using visual basic 8.0..
    but i need to find the mykad projct using visualbasic 6.0
    anyone can help?

    meNo Gravatar

    16 Mar 10 at 12:14 PM

  13. i have this code running in VB6.0 but the code using another smartcard reader device..
    i want to change it using the IRIS(SCR21U) smartcard reader.. anyone can help me,to change this particular variable/declaration in this code. i just want to read from IRIS cardreader.. how?

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    
    Private Sub BeginTransaction_Click()
        Dim strFilename As String
        Dim strResult As String
        Dim strIDNum As String
        Dim strLicenseKey As String
        strLicenseKey = "J4tvlfAAVnERRWQSYWHx4AcHxDiMYwKsbqOIYP0a4tfIV2jKB+CbMSbkT/DUNOPH7JvLHmV7ayKmrF3ePBY8Aw=="
     
        Dim oMykad As New mykadpro.jpn          '--for vb6 user use this declaration
        '--Dim oMykad As New mykadproweb.jpn    '--for web user use this declaration.make sure "mykadproweb.dll.config" copied to "c" drive root
        
        Screen.MousePointer = vbHourglass
     
        strResult = oMykad.BeginJPN(txtReadername.Text, strLicenseKey)      '--for vb6 user use this function
        '--strResult = oMykad.BeginJPN(txtReadername.Text)                  '--for web user use this declaration
        
            If strResult = "0" Then
                lstData.Clear
                lstData.AddItem ("YOUR MYKAD INFORMATIONS (READ ONLY)")
     
                strIDNum = oMykad.getIDNum
                lstData.AddItem ("getIDNum: " & strIDNum)
                lstData.AddItem ("getKPTName: " & oMykad.getKPTName)
                lstData.AddItem ("getGMPCName: " & oMykad.getGMPCName)
                lstData.AddItem ("getAddress: " & oMykad.getAddress)
                lstData.AddItem ("getGender: " & oMykad.getGender)
                lstData.AddItem ("getRace: " & oMykad.getRace)
                lstData.AddItem ("getOldIDNum: " & oMykad.getOldIDNum)
                lstData.AddItem ("getBirthPlace: " & oMykad.getBirthPlace)
                lstData.AddItem ("getBirthDate: " & oMykad.getBirthDate)
                lstData.AddItem ("getCitizenship: " & oMykad.getCitizenship)
                lstData.AddItem ("getReligion: " & oMykad.getReligion)
                lstData.AddItem ("getCardVer: " & oMykad.getCardVer)
                lstData.AddItem ("getDateIssued: " & oMykad.getDateIssued)
                lstData.AddItem ("getGreenCardExpiry: " & oMykad.getGreenCardExpiry)
                lstData.AddItem ("getGreenCardNationality: " & oMykad.getGreenCardNationality)
     
                'thumb print
                strFilename = "out/" & strIDNum & "_thumbright.txt"
                strResult = oMykad.getThumbRight(strFilename)
                lstData.AddItem ("ThumbPrintRight: " & strFilename)
     
                strFilename = "out/" & strIDNum & "_thumbleft.txt"
                strResult = oMykad.getThumbLeft(strFilename)
                lstData.AddItem ("ThumbPrintLeft: " & strFilename)
     
                'photo
                If chkPhoto.Value = 1 Then
                    strFilename = "out/" & strIDNum & "_myphoto.jpg"
                    If oMykad.getPhoto(strFilename) = True Then
                        picMyKad.Picture = LoadPicture(strFilename)
                    End If
                    lstData.AddItem ("Photo: " & strFilename)
                End If
                MsgBox "Retrieve MYKAD Informations completed!", vbOKOnly + vbInformation, strTitle
            Else
                MsgBox strResult, vbOKOnly + vbCritical, strTitle
            End If
     
            strResult = oMykad.EndJPN()
     
            Screen.MousePointer = vbNormal
    End Sub

    meNo Gravatar

    16 Mar 10 at 12:36 PM

  14. hai. i need the mykadpro.dll…where i can get it..please help me

    hafizal samsiNo Gravatar

    19 May 10 at 01:52 PM

  15. amreeNo Gravatar

    19 May 10 at 02:13 PM

  16. amree, can the VB program you posted work with any card readers? If not, what have to be customized to make it work with a reader? What brand of card reader you would recommend and where to buy an economical one?

    I can’t find mykadpro.dll on http://lmgtfy.com/?q=mykadpro.dll. Can you help to upload it to this site?

    Thanks and will appreciate your reply.

    cheeNo Gravatar

    25 May 10 at 02:39 PM

  17. @chee

    First of all, the VB program I posted is not mine, but I do believe it can be used with any PC/SC compatible reader.

    To this day, I’ve only used 2 card reader (from Athena and Omnikey), both of them are from oversea due to their ability to support Linux. So, I’m not sure about Malaysia’s price. For Athena, you could get it at RM 160 per unit (including postage to Malaysia).

    The reason I’m posting a link to Google is because I don’t know where you can get that DLL. Most probably from MYKADPro. It seems they are selling a PC/SC compatible reader too, maybe it will work with those codes, but I haven’t tested it myself.

    amreeNo Gravatar

    25 May 10 at 03:25 PM

  18. U can use any smartcard reader. I tested this apps on my laptop with build-in smartcard reader. This apps able to read out all my basic particulars from my IC, including the photo.

    CH NgNo Gravatar

    2 Jun 10 at 04:00 PM

  19. @CH Ng

    Thank you for your information, maybe you could post what model your laptop is ?

    amreeNo Gravatar

    2 Jun 10 at 04:56 PM

Leave a Reply