Python script for scanning, decoding, and verifying the EU Covid-19 vaccine certificate, as specified by the EU.
CovPass-Scanner scans the QR code of a vaccine certificate using a webcam. Certificate validity and name of the owner are displayed on-screen. This allows for quickly verifying the certificates of visitors.
The script is heavily based on hannob/vacdec (data extraction) and HQJaTu/vacdec (signature verification). Check out these repositories for more information on the innner workings.
- Scans QR code of EU Green Pass / vaccination certificate via a webcam
- Verifies that the cerificate has been signed by a valid official entity
- Optionally scans an ID card (see separate branch at the moment) and checks whether data from certificate matches data on ID card
- Displays checkmark and plays sound if certificate was verified successfully
- Can be run on a Raspberry Pi
- When using a fixed-focus camera, check happens much faster than with mobile apps
- Currently uses an old list of valid signing keys that may or may not work for your audience
- Not all possible exceptions are handled at the moment. The program may crash on unexpected data.
- ID card check uses OCR and is rather slow due to pytesseract.
- ID card check does not check the validity of the card - it just compares data from the ID card to that from the vaccination certificate
- No persistent logging of certificate checks
You will need:
- pillow for image handling
- pyzbar for reading QR-code
- base45, cbor2 and cose packages for RFC-8152 data structure reading
- Additionally, you need zbar
- For Mac OS X, it can be installed via
brew install zbar
- Debian systems via
apt install libzbar0
. Source - Fedora / Red Hat
dnf install zbar
- For Mac OS X, it can be installed via
- opencv for webcam mode
- pygame for playing sound
Install them via your distribution or via pip:
pip install -r requirements.txt
Run:
./covpass-scanner --image-file <image>
or
./covpass-scanner --camera <camera device, e.g. /dev/video0>
image
can be an image in any format pillow supports, including of
course PNG and JPG.
$ ./vacdec --image-file samples/Sweden-2.png
2021-08-05 19:33:39,927 [INFO ] COVID certificate signed with X.509 certificate.
2021-08-05 19:33:39,927 [INFO ] X.509 in DER form has SHA-256 beginning with: 5f74910195c5cecb
2021-08-05 19:36:24,800 [INFO ] Found the key from DB!
2021-08-05 19:36:24,820 [INFO ] Signature verified ok
2021-08-05 19:33:39,928 [INFO ] Certificate as JSON: {
"1": "SE",
"4": 1625305802,
"6": 1623750603,
"-260": {
"1": {
"t": [
{
"ci": "URN:UVCI:01:SE:EHM/TARN89875439877",
"co": "SE",
"is": "Swedish eHealth Agency",
"nm": "Roche LightCycler qPCR",
"sc": "2021-06-15 09:24:02+00:00",
"tc": "Arlanda Airport Covid Center 1",
"tg": "840539006",
"tr": "260415000",
"tt": "LP6464-4"
}
],
"dob": "1958-11-11",
"nam": {
"fn": "Lövström",
"gn": "Oscar",
"fnt": "LOEVSTROEM",
"gnt": "OSCAR"
},
"ver": "1.3.0"
}
}
}
(Note: formerly known as Digital Green Certificate)
What's in a EU Digital COVID/Green Certificate?
- Value Sets for Digital Green Certificates https://ec.europa.eu/health/sites/default/files/ehealth/docs/digital-green-certificates_dt-specifications_en.pdf
- JSON schema: https://github.com/ehn-dcc-development/ehn-dcc-schema
Digital Green Certificate Gateway (DGCG) samples for all participating countries: https://github.com/eu-digital-green-certificates/dgc-testdata
- Digital Green Certificate Gateway (DGCG) Swagger: https://eu-digital-green-certificates.github.io/dgc-gateway/
- API-key needed. Get it from ???
- French solution to gather a list of all:
- Swedish list of all certificates: https://dgcg.covidbevis.se/tp/
Original code written by Hanno Böck. Signature verification added by Jari Turkia. Minor fixes, decoding of Digital Green Certificate Values Sets, webcam mode and ID card scanning by Raphael Wimmer, Thomas Fischer and Vitus Maierhöfer.
- CovPass-Scanner is based on hannob/vacdec and HQJaTu/vacdec
- lucadentella/raspberry-dgc - client-server solution consisting of a Raspberry Pi running Python code and a web server implementing signature verification and business rules
- panzi/verify-ehc - a simple Python script to decode and verify an European Health Certificate QR-code (also supports download of trust lists).
- There are a few commercial standalone scanners for vaccination certificates available online (1)