Decode the Ontario proof of vaccination QR code

Overview

Decode the contents of the Ontario Proof of Vaccination (the "Smart Health Card QR Code")

Output

This is from my QR code, hopefully fully redacted although I suspect it tells you what kind of doses I got.

{
  "iss": "https://prd.pkey.dhdp.ontariohealth.ca",
  "nbf": 1634342670.448,
  "vc": {
    "type": [
      "https://smarthealth.cards#health-card",
      "https://smarthealth.cards#immunization",
      "https://smarthealth.cards#covid19"
    ],
    "credentialSubject": {
      "fhirVersion": "4.0.1",
      "fhirBundle": {
        "resourceType": "Bundle",
        "type": "collection",
        "entry": [
          {
            "fullUrl": "resource:0",
            "resource": {
              "resourceType": "Patient",
              "name": [
                {
                  "family": "FAMILY NAME",
                  "given": [
                    "FIRST NAME",
                    "MIDDLE NAMES"
                  ]
                }
              ],
              "birthDate": "YYYY-MM-DD"
            }
          },
          {
            "fullUrl": "resource:1",
            "resource": {
              "resourceType": "Immunization",
              "meta": {
                "security": [
                  {
                    "system": "https://smarthealth.cards/ial",
                    "code": "IAL1.4"
                  }
                ]
              },
              "status": "completed",
              "manufacturer": {
                "identifier": {
                  "system": "http://hl7.org/fhir/sid/mvx",
                  "value": "MOD"
                }
              },
              "vaccineCode": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/sid/cvx",
                    "code": "207"
                  },
                  {
                    "system": "http://snomed.info/sct",
                    "code": "28571000087109"
                  }
                ]
              },
              "occurrenceDateTime":  "YYYY-MM-DD",
              "lotNumber": "DDDDDDD",
              "patient": {
                "reference": "resource:0"
              },
              "performer": [
                {
                  "actor": {
                    "display": "ON, Canada"
                  }
                }
              ]
            }
          },
          {
            "fullUrl": "resource:2",
            "resource": {
              "resourceType": "Immunization",
              "meta": {
                "security": [
                  {
                    "system": "https://smarthealth.cards/ial",
                    "code": "IAL1.4"
                  }
                ]
              },
              "status": "completed",
              "manufacturer": {
                "identifier": {
                  "system": "http://hl7.org/fhir/sid/mvx",
                  "value": "MOD"
                }
              },
              "vaccineCode": {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/sid/cvx",
                    "code": "207"
                  },
                  {
                    "system": "http://snomed.info/sct",
                    "code": "28571000087109"
                  }
                ]
              },
              "occurrenceDateTime": "YYYY-MM-DD",
              "lotNumber": "DDDDDDD",
              "patient": {
                "reference": "resource:0"
              },
              "performer": [
                {
                  "actor": {
                    "display": "ON, Canada"
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Setup

This runs in python3. I strongly suggest you set up a virtualenv before installing any python packages. Check one of these guides:

(If you're new to python, I appologize for the mess that is package management in python)

We need a JWT library, PyJWT seems to be the top python library. Sadly it doesn't support the body being compressed as happens with SHC. Thankfully, someone has created a fix for this, but it hasn't merged yet. https://github.com/jpadilla/pyjwt/pull/666

pip install 'git+https://github.com/Roguelazer/pyjwt.git@deflate#egg=pyjwt[crypto]'

OR

pip install -r requirements.txt

TODO

  • verify signature, not sure where the .well-known/jwjks.json is for Ontario
  • read in the PDF or an image with a QR Code?

Refs

You might also like...
Python script to decode the EU Covid-19 vaccine certificate

vacdec Python script to decode the EU Covid-19 vaccine certificate This script takes an image with a QR code of a vaccine certificate as the parameter

Ini Hanya Shortcut Untuk Menambahkan Kunci Tambahan Pada Termux & Membantu Para Nub Yang Decode Script Orang:v

Ini Hanya Shortcut Untuk Menambahkan Kunci Tambahan Pada Termux & Membantu Para Nub Yang Decode Script Orang:v

Python Proof of Concept for retrieving Now Playing on YouTube Music with TabFS

Youtube Music TabFS Python Proof of Concept for retrieving Now Playing on YouTube Music with TabFS. music_information = get_now_playing() pprint(music

⚡ PoC: Hide a c&c botnet in the discord client. (Proof Of Concept)
⚡ PoC: Hide a c&c botnet in the discord client. (Proof Of Concept)

Discord-BotnetClient Embed C&C botnet into the discord client. Working trought websocket c&c server. How to use. pip3 install websocket_server colored

A github actions + python code to extract URLs to code repositories to put into standard form, starting with github

A github actions + python code to extract URLs to code repositories to put into standard form, starting with github ---- NOTE: JUS

QR-Code-Grabber - A python script that allows a person to create a qr code token grabber
QR-Code-Grabber - A python script that allows a person to create a qr code token grabber

Qr Code Grabber Description Un script python qui permet a une personne de creer

My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA

My solutions to adventofcode.com puzzles. I post videos of me solving the puzzles in real-time at https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41

Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!

Google Images Download Python Script for 'searching' and 'downloading' hundreds of Google images to the local hard disk! Documentation Documentation H

“ Hey there 👋 I'm Daisy „ AI based Advanced Group Management Bot Suit For All Your Needs ❤️.. Source Code of @Daisyxbot

Project still under heavy development Everything will be changed in the release “ Hey there 👋 I'm Daisy „ AI based Advanced telegram Group Management

Comments
  • URL for the Ontario key

    URL for the Ontario key

    The SMART Health Card spec suggests the key(or keys) to verify be located at the issuer URL with well-known/jwks.json added. In this case Ontario's key would be at https://prd.pkey.dhdp.ontariohealth.ca/.well-known/jwks.json

    opened by hotcobra 0
Owner
Wesley Ellis
Wesley Ellis
This very basic script can be used to automate COVID-19 vaccination slot booking on India's Co-WIN Platform.

COVID-19 Vaccination Slot Booking Script This very basic CLI based script can be used to automate covid vaccination slot booking on Co-WIN Platform. I

null 605 Dec 14, 2022
Telegram bot to check availability of vaccination slots in India.

cowincheckbot Telegram bot to check availability of vaccination slots in India. Setup Install requirements using pip3 install -r requirements.txt Crea

Muhammed Shameem 10 Jun 11, 2022
Tools to download and aggregate feeds of vaccination clinic location information in the United States.

vaccine-feed-ingest Pipeline for ingesting nationwide feeds of vaccine facilities. Contributing How to Configure your environment (instructions on the

Call the Shots 26 Aug 5, 2022
A Python Script to automate searching of available vaccination centers in the city and hence booking

Cowin Vaccine Availability Notifier Cowin Vaccine Availability Notifier takes your City or PIN code as an input and automatically notifies you via ema

Jayesh Padhiar 7 Sep 5, 2021
Benachrichtigungs-Bot für das niedersächische Impfportal / Notification bot for the lower saxony vaccination portal

Ein kleines Wochenend-Projekt von mir. Der Bot überwacht die REST-API des niedersächsischen Impfportals auf freie Impfslots und sendet eine Benachrichtigung mit deinem bevorzugtem Service. Ab da gilt leider: der Schnellste gewinnt. Bitte missbraucht den Bot nicht und verwendet moderate Intervalle.

sibalzer 37 May 11, 2022
This script books automatically a slot on Doctolib in one of the public vaccination centers in Berlin.

BOOKING IN BERLINS VACCINATION CENTERS This python script books automatically a slot on Doctolib in one of the public vaccination centers in Berlin. T

null 17 Jan 13, 2022
CoWIN Vaccination slot booking telegram bot with auto captcha resolver & alerting feature.Now, never miss a slot.

COWIN VACCINATION SLOT AUTO BOOKING (Bot with captcha solving & alerting capabilities. Never miss the vaccine slot.) June-10-2021/ 0030 hrs: 23 succes

Shashank Bafna 17 Nov 12, 2022
A Python Script to automate searching of available vaccination centers in the city and hence booking

Cowin Vaccine Availability Notifier Cowin Vaccine Availability Notifier takes your City or PIN code as an input and automatically notifies you via ema

Jayesh Padhiar 7 Sep 5, 2021
A Telegram bot that scrapes websites for available vaccination appointments to notify users. (German)

@dachau_impf_bot ???? A Telegram bot to check the contents of https://termin.dachau-med.de for available slots and inform users of the available dates

null 1 Nov 21, 2021
A simple bot that looks for names and cpfs in the vaccination list made available by the government Fortaleza - CE

A simple bot that looks for names and cpfs in the vaccination list made available by the government Fortaleza - CE

Breno Aquino 1 Dec 21, 2021