Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
/ dgc-java Public archive

Java implementation of the EU eHealth Digital Green Certificates.

License

Notifications You must be signed in to change notification settings

diggsweden/dgc-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

dgc-java

License: MIT Maven Central

An implementation in Java for creating and validating a EU Digital Covid Certificate.


About

This repository contains the Java libraries dgc-schema and dgc-create-validate for creating and validating EU Digital Covid Certificates. It is maintained by the Swedish Agency for Digital Government.

Note: The commission has decided on a late name change where the Digital Green Certificate was renamed to EU Digital Covid Certificate. Therefore, you'll find a lot of code in this library where the abbreviation DGC is used instead of DCC.

Resources

Structure

The code is structured into the following parts:

  • API - Java POJO:s generated from the schema. dgc-schema

  • CBOR, CWT/COSE - Support for representing the DGC in CBOR and to sign/validate it. dgc-create-validate

  • Compresssion/decompression. dgc-create-validate

  • Base45 implementation. dgc-create-validate

  • QR code generation - Support for creating/reading QR-codes. dgc-create-validate

  • UVCI generation including Luhn mod N checksum calculation. dgc-create-validate

  • Service layer - A service that ties all the above components together and presents high-level methods for creating and validating EU Digital Covid Certificates. dgc-create-validate

Maven

Include the following in your POM:

<dependency>
  <groupId>se.digg.dgc</groupId>
  <artifactId>dgc-schema</artifactId>
  <version>${dgc-java.version}</version>
</dependency>

<dependency>
  <groupId>se.digg.dgc</groupId>
  <artifactId>dgc-create-validate</artifactId>
  <version>${dgc-java.version}</version>
</dependency>

The dgc-create-validate library offers a barcode (QR) implementation using the ZXing library, but the BarcodeCreator and BarcodeDecoder interfaces make it possible to implement your own barcode support using the library of your own choice. Therefore the dependencies to the ZXing jars are marked as optional in the dgc-create-validate POM. If you want to use the default implementation you need to include the following in your POM:

<dependency>
  <groupId>com.google.zxing</groupId>
  <artifactId>core</artifactId>
  <version>3.4.1</version>
</dependency>
    
<dependency>
  <groupId>com.google.zxing</groupId>
  <artifactId>javase</artifactId>
  <version>3.4.1</version>
</dependency>

At least version 3.4.1 of the ZXing libraries are required.

Note: Only the Java 11 build is published to Maven central (see Java 8 note below).

For Java 8 users

On request, the libraries can also be built with Java 8. However, they are not published to Maven central.

To build:

>mvn clean install -P\!default,j8-build

Now, the artifacts dgc-schema-java8 and dgc-create-validate-java8 will be built.

Documentation

Java API documentation of the library:

Acknowledgements


Copyright © 2021-2023, Myndigheten för digital förvaltning - Swedish Agency for Digital Government (DIGG). Licensed under the MIT license.