gitmyhub

cnie-python-tools

Python ★ 94 updated 23d ago

Experimental Python toolkit for reading the French National Identity Card (*Carte Nationale d'Identité*, CNI) via a PC/SC **contact** smart card reader, using PACE-CAN authentication and Secure Messaging.

An experimental Python tool that reads the chip in newer French ID cards through a smart card reader, extracting the photo and printed personal data.

PythonpyscardPC/SCsetup: hardcomplexity 5/5

This is an experimental Python toolkit for reading the chip inside the newer French national identity card, using a physical smart card reader plugged into your computer. It is built for education and research, and the author says it should only be used on cards you own or have explicit permission to read.

Since 2021, French identity cards have carried a chip that stores a person's basic details and photo in a standardized format used on passports and ID cards worldwide. To talk to that chip, the tool first proves it has permission by using a six digit access code printed on the front of the card, then sets up an encrypted channel so nothing sent back and forth can be read by anyone else nearby. Once connected, it reads the different sections of data stored on the chip: the machine readable text at the bottom of the card, the passport style photo, and some additional personal fields such as address, birth place, and height, though those extra fields are read on a best effort basis since their exact layout is not fully documented. It also checks the digital hash values on the card to confirm the data has not been tampered with, though it does not yet verify the full certificate chain behind those hashes.

Importantly, the tool cannot read fingerprints or iris scans stored on the chip, since those are locked behind a separate government controlled security layer that requires an official terminal certificate the tool does not have.

It needs a compatible smart card reader, works primarily with a handful of tested contact readers, and one contactless reader has also been confirmed to work by the community. Setup requires installing a smart card driver stack on Linux, then installing the Python package itself, after which a single command line tool dumps the card's contents to a folder as both raw files and a structured summary file. The project is released under the MIT license.

Where it fits