No description
Find a file
amir-climy 26637fff9f Remove fingerprint image from repo, gitignore *.png
Generated output files with biometric data should not be tracked.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 00:01:48 +08:00
.gitignore Remove fingerprint image from repo, gitignore *.png 2026-06-08 00:01:48 +08:00
mykad_reader.py Add fingerprint minutiae parser and image output 2026-06-07 23:44:58 +08:00
README.md Add fingerprint minutiae parser and image output 2026-06-07 23:44:58 +08:00
requirements.txt Add fingerprint minutiae parser and image output 2026-06-07 23:44:58 +08:00

MyKad Smart Card Reader

Reads personal identity and biometric data from a Malaysian MyKad chip using a PC/SC smart card reader on macOS.

Hardware

Component Device
Smart card reader Intellego/WaveTree Mobile MyKad Biometric Reader (Generic EMV Smartcard Reader)
Fingerprint sensor IDEMIA CBM-V3 (Morpho) — not used in this script
Interface USB-C

Prerequisites

macOS

macOS includes the PC/SC stack (usbsmartcardreaderd) — no additional driver is needed.

Install dependencies:

pip3 install -r requirements.txt --break-system-packages

Windows

Windows includes the Smart Card Base Components (WinSCard) — no additional driver or daemon is needed. The reader works with the built-in Windows CCID driver.

Step 1 — Install Python 3

Download from python.org. During installation, check "Add Python to PATH".

Step 2 — Install dependencies

Open Command Prompt or PowerShell and run:

pip install -r requirements.txt

Step 3 — Clone the repository

git clone https://forgejo.primatekun.tech/amiryahaya/mykad_reader.git
cd mykad_reader

Step 4 — Plug in the reader and insert MyKad

Connect the reader via USB-C. Insert your MyKad (gold chip facing down, chip end first).

Step 5 — Run

python mykad_reader.py

Setup (macOS)

  1. Plug in the reader via USB-C.
  2. Verify the reader is detected:
python3 -c "from smartcard.System import readers; print(readers())"
# Expected: [Generic EMV Smartcard Reader, Generic EMV Smartcard Reader 01]
  1. Insert your MyKad into the reader (gold chip facing down, chip end first).

Usage

macOS:

python3 mykad_reader.py

Windows:

python mykad_reader.py

Example output

PC/SC readers (2):
  [0] Generic EMV Smartcard Reader
  [1] Generic EMV Smartcard Reader 01

Card found in: Generic EMV Smartcard Reader 01
JPN application selected.
Reading personal data...
Reading address data...
Reading biometrics data...

============================================================
  MyKad Identity
============================================================
  IC Number           : 780817XXXXXXXX
  Name                : YOUR NAME HERE
  Date of Birth       : DD-MM-YYYY
  Gender              : Male (Lelaki)
  Religion            : ISLAM
  Race                : MELAYU
  Nationality         : WARGANEGARA
  Birth Place         : PULAU PINANG
  Address             : NO 1 JALAN EXAMPLE
                        TAMAN EXAMPLE
                        12345 BANDAR EXAMPLE
                        KEDAH
============================================================

============================================================
  MyKad Biometrics — File 3
============================================================
  Tag             : R1L1

  Right thumb (R1)
    Size          : 598 bytes
    Data density  : 288 non-null/FF bytes (48.2%)
    Saved to      : ./fp_right.bin

  Left  thumb (L1)
    Size          : 598 bytes
    Data density  : 294 non-null/FF bytes (49.2%)
    Saved to      : ./fp_left.bin
============================================================
  Note: Templates are in IDEMIA proprietary format.
        Use MorphoSmart SDK for 1:1 matching against live capture.

Fingerprint templates are saved as fp_right.bin and fp_left.bin in the working directory.

Data read from card

File Contents
File 1 (459 bytes) Name, IC number, date of birth, gender, old IC, birth place, nationality, race, religion
File 3 (1227 bytes) Right thumbprint template (598 bytes) + left thumbprint template (598 bytes)
File 4 (171 bytes) Address lines, postcode, city, state

Troubleshooting

No readers found

  • macOS — Replug the USB-C cable. The PC/SC daemon restarts automatically on reconnect.
  • Windows — Open Device Manager and confirm the reader appears under Smart card readers. If it shows a warning icon, reinstall the driver or replug the cable.

Card not detected (No card detected in any reader slot)

  • Make sure the card is inserted firmly, chip end first, gold contacts facing down.
  • Remove and reinsert the card, then re-run the script.

SELECT AID failed

The inserted card is not a MyKad, or the chip is not responding. Try reinserting.

Protocol notes

MyKad uses a proprietary JPN (Jabatan Pendaftaran Negara) application:

Step APDU
SELECT application 00 A4 04 00 0A A0 00 00 00 74 4A 50 4E 00 10
Set read length C8 32 00 00 05 08 00 00 <len_lo> <len_hi>
Select file + offset CC 00 00 00 08 <file_lo> <file_hi> 01 00 <off_lo> <off_hi> <len_lo> <len_hi>
Read data CC 06 00 00 <chunk_size>

Data offsets reference: nikizwan.com/reading-mykad-and-parse-data-via-apdu-command
Protocol reference: github.com/Josan88/mykad