Skip to main content

DCC Utils for Python

Project description

Python library to decode the EU Covid-19 vaccine certificate, as specified by the EU.

Setup

pip install dcc-utils

Make sure zbar is installed in your system * 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

Usage

Parse DCC

This library takes an image with a QR code or a raw repr. of a vaccine certificate as the parameter and will show the certificate’s content.

from dcc_utils import from_image

dcc_from_img = from_image("/my/certificate/path")
dcc_from_raw = from_raw("HC1:6BF...FTPQ3C3F")

Then you can access to payload and kid

assert dcc_from_img.kid == "53FOjX/4aJs="
assert dcc_from_img.payload["v"][0]["ci"] == "URN:UVCI:01:FR:W7V2BE46QSBJ#L"

from_image and from_raw methods may rise DCCParsingError

from dcc_utils.exceptions import DCCParsingError

Validate DCC digital signature

signature = """
-----BEGIN CERTIFICATE-----
MIIIAjCCBeqgAwIBAgIQAnq8g/T
-----END CERTIFICATE-----
"""
assert dcc.check_signature(signature)

check_signature method may rise DCCSignatureError

from dcc_utils.exceptions import DCCSignatureError

Dev setup

Install dependencies via your distribution or via pip:

pip install -r requirements-dev.txt

Run tests

make test

EU Digital COVID Certificate Specifications

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

Sample data

Digital Green Certificate Gateway (DGCG) samples for all participating countries: https://github.com/eu-digital-green-certificates/dgc-testdata

License

This library is available under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dcc-utils-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

dcc_utils-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file dcc-utils-0.1.0.tar.gz.

File metadata

  • Download URL: dcc-utils-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for dcc-utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f32457ed1cc266ce38ea6873f48c045011e6b77d7f8e33de00f84249608df234
MD5 fc1a8f8e8a37a78147dae8c32f83646e
BLAKE2b-256 a269e85e2970e88e801fde4149e15bb0ab7a64a1a102cced51384077ccc850a0

See more details on using hashes here.

File details

Details for the file dcc_utils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dcc_utils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for dcc_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 466027d3e5e3867d7970b0bbdc28152d55f1292a6962b2a01f5cd48b22d32de3
MD5 223d79193a7c720de4a974b4ca0b830e
BLAKE2b-256 8a97f3ec5cf17051e95b401972107458062b1837f76084a3ea6fd120d9acd106

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page