admin-ch / CovidCertificate-Apidoc

API documentation for the integration of primary systems with the machine to machine API
73 stars 7 forks source link

Update README.md #1

Closed mofobo-bit closed 3 years ago

mofobo-bit commented 3 years ago

Swiss Covid Certificate-API documentation

Table of contents

Table of contents generated with markdown-toc

Introduction

In the global context of COVID-19 pandemic, questions of certifications have arisen regarding the attestations of vaccine, negative test and immunitie. It is in order to respond to this situation related to the certification of attestations, that the project Swiss Covid Certificate (abbr. SCC) was developed under a mandate from the Federal Office of Public Health (abbr. FOPH). This project provides a digital certification service aimed at licensed health professionals as well as the various licensed actors stakeholders which in collaboration with health professionals, store and manage informations related to Covid attestations. Beside the certification service, the SCC also provide a certificate revocation service and a certificate verification service. A public mobile application has been developed to save these personal certificates in digital formats and another mobile application has also been developed to verifiy the validity of these certificates.

This certification is compatible with the EU digital green certification.

The SCC project is developed, hosted and maintained by the The Federal Office of Information Technology, Systems and Telecommunication (abbr. FOITT)

This documentation is intended for integrators of third party systems who wish to integrate the SCC digital certification service to their system.

Licensed entities

Third party system integration

Integration achitecture

Authentication with one-time password

A one-time password (abbr. OTP) is required to authenticate to the service API. This OTP is provided to the authorized user through the Web management UI. The OTP must be stored in the primary system and used in the REST API request. The OTP has a limited validity. image

  1. The authorized user previously registered and recognised by eIAM can obtain an OTP by logging to the Web management UI page.
  2. When the authorized user access the Web management UI, its rights are verified by eIAM.
  3. The authorized user must insert the OTP in the primary system so that it is transmitted when calling the REST API.
  4. One-way authentication is used to create the TLS tunnel to protect the data transfer.
  5. The OTP is transferred so that the authorized user can be identified, as header of the request.
  6. The content is hashed and signed with primary key of the "SwissGov Regular CA 01" certificate distributed to the primary system.
  7. The dataset structured as JSON Schema is created and transported within the secured TLS tunnel.
  8. The Management Service REST API checks the integrity of the data and signature received and the OTP.

Sequence diagram

image

Security architecture

Authorized user

The authorized users are onboarded in eIAM and can use a CHLogin or a HIN identity. They access the API by sending an OneTime password (OTP as JSON Web Token - JWT) generated from the Web management UI.

TLS tunnel

A TLS tunnel (single way authentication) is made between the primary system and the API gateway. One "SwissGov Regular CA 01" certificate is delivered to each primary system for this purpose.

Content signature

The content transferred to the REST API is signed with the "SwissGov Regular CA 01" certificate. The public key of the "SwissGov Regular CA 01" certificate has not to be added to the API request.

The process is the following:

  1. Primary system creates a hash of the message to be sent = data used to create the covid certificate (JSON data) or revocation data (JSON data)
  2. Primary system encrypts this hash using the private key of the "SwissGov Regular CA 01" certificate used to authenticate itself.
  3. Primary system places the JSON data and the signed hash in the payload and sends the message to generation REST API or to revocation REST API.
  4. TODO Add JWT in HEADER ?

Certificate data

A Covid certificate will always contain the covid certificate owner personal data plus a set of type specific data (types: vaccination, test or recovery).

[*: mandatory]

Personal data (always present)

Type: Vaccin

Type: Test

Type: Recovery

Technical specification

Generation API

Three types of covid certificate can be requested through the generation API:

See the API specifications for further informations.

Error codes

There is a custom error body for the request if the server side parameter validation fails.

As well as when the integrity check fails:

Revocation API

???TBD???

Verification API

???TBD???

What's next?

... say hello

... furthermore

Miscellaneous

EU digital green certificate