To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations

Related tags

Testingdgc-testdata
Overview

EU Digital COVID Certificate: Test Data Repository for Test Automation

AboutTesting & Status2D CodeHow to ContributeLicensing

About

To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations, a lot of data has to be collected to ensure the variance of the tests. This respository was established to collect a lot of different test data and related test cases of different member states in a standardized manner. Each member state can generate a folder in this section.

Testing & Status

  • If you found any problems, please create an Issue.
  • Please make sure to review the issues to see if any other members states found issues with your provided test data.

2D Code

Test Procedure

The test procedure has the following steps:

  1. Load RAW Data File X
  2. Apply all test and validation rules to File X (from all countries).
  3. If one rule fails, the RAW Data File X is highlighted with the related Validation Rule/TestName Fail Status.

Note: If some of the "EXPTECEDRESULT" values are not present, the steps in the tests run can be skipped. The related data can be removed then as well. E.g. if just a "Expireing" test is constructed, the "EXPECTEDEXPIRATIONCHECK" value can be set together with an "COSE" and "VALIDATIONCLOCK" raw object. All other fields are then not necessary.

Field Definition
JSON The JSON-encoding of the Digital Green Certificate payload
CBOR The CBOR-encoding of the Digital Green Certificate payload
COSE The CWT defined by the hCert Spec.
COMPRESSED A CWT compressed by zLib
BASE45 The base45 encoding of the compression.
PREFIX The base45 string concatenated with the Prefix (HC1 etc.)
2DCODE The base64 encoded PNG of a QR Code.
TESTCTX Testcontext with context information of the raw data.
EXPECTEDRESULTS A list of expected results to the testdata.

Possible boolean variables set in EXPECTEDRESULTS:

  • EXPECTEDSCHEMAVALIDATION: Decoded data is valid according to dgc-schema
  • EXPECTEDDECODE: Data from input in CBOR can be decoded, and the contents match input from JSON
  • EXPECTEDVERIFY: Data from input in COSE can be cryptographically verified, with signer's certificate from TESTCTX.CERTIFICATE
  • EXPECTEDUNPREFIX: Data from input in PREFIX can be decoded, i.e. contains a valid prefix (e.g. HC1: for now), and is equal to input in BASE45
  • EXPECTEDVALIDJSON: Data from input (i.e. 2DCODE or PREFIX) can be decoded (whole chain), and the contents match input from JSON
  • EXPECTEDCOMPRESSION: Data from input in COMPRESSED can be decompressed (with ZLIB), and matches input in COSE
  • EXPECTEDB45DECODE: Data from input in BASE45 can be decoded (from Base45), and matches input in COMPRESSED
  • EXPECTEDPICTUREDECODE: Data from input in 2DCODE can be decoded (from Base64-encoded PNG), and matches input in PREFIX
  • EXPECTEDEXPIRATIONCHECK: Data from input is valid when verifying at the moment defined in TESTCTX.VALIDATIONCLOCK
  • EXPECTEDKEYUSAGE: Data from input in COSE can be verified, and the key usage (defined by the OIDs) from TESTCTX.CERTIFICATE matches the content (i.e. it is a test statement, vaccination statement, or recovery statement)

For all variables above:

  • When not set, this specific validation step is not tested in this input file
  • When set to true, this validation step should succeed
  • When set to false, this validation step should fail

Gateway

To indidcate which gateway environment is available, the test data context should contain: GATEWAY-ENV:Array

Example:

GATEWAY-ENV:["ACC", "TST"]

Note: Prod Keys should not be uploaded.

Code Generation

Test Number Test Mandatory Fields Mandatory Test Context Fields Variable
1 Load RAW File and load JSON Object, validate against the referenced JSON schema in the test context(SCHEMA field). JSON SCHEMA EXPECTEDVALIDOBJECT
2 Create CBOR from JSON Object. Validate against the CBOR content in the RAW File. See note 2 below. JSON, CBOR EXPECTEDENCODE

NOTE: DESCRIPTION, VERSION are mandatory for all tests.

NOTE 2: CBOR objects that are maps (i.e., the Digital Green Certificate), have an undefined order. This means that the actual encodings between two objects containing the same elements may differ since the ordering may be different. Therefore the validation can not be as simple as comparing two byte arrays against each other. The best method is to decode both elements that are to be compared with the same decoder, encode both objects with the same encoder, and then compare.

Code Validation

Test Number Test Mandatory Fields Mandatory Test Context Fields Variable
1 Load the picture and extract the prefixed BASE45content. PREFIX , 2DCode EXPECTEDPICTUREDECODE
2 Load Prefix Object from RAW Content and remove the prefix. Validate against the BASE45 raw content. PREFIX, BASE45 EXPECTEDUNPREFIX
3 Decode the BASE45 RAW Content and validate the COSE content against the RAW content. BASE45, COSE EXPECTEDB45DECODE
4 Check the EXP Field for expiring against the VALIDATIONCLOCK time. COSE VALIDATIONCLOCK EXPECTEDEXPIRATIONCHECK
5 Verify the signature of the COSE Object against the JWK Public Key. COSE JWK EXPECTEDVERIFY
6 Extract the CBOR content and validate the CBOR content against the RAW CBOR content field. See note 2 below. COSE,CBOR EXPECTEDDECODE
7 Transform CBOR into JSON and validate against the RAW JSON content. See note 3 below. CBOR,JSON EXPECTEDVALIDJSON
8 Validate the extracted JSON against the schema defined in the test context. CBOR,JSON SCHEMA EXPECTEDSCHEMAVALIDATION
9 The value given in COMPRESSED has to be decompressed by zlib and must match to the value given in COSE COSE,COMPRESSED EXPECTEDCOMPRESSION

NOTE: DESCRIPTION, VERSION are mandatory for all tests.

NOTE 2: CBOR objects that are maps (i.e., the Digital Green Certificate), have an undefined order. This means that the actual encodings between two objects containing the same elements may differ since the ordering may be different. Therefore the validation can not be as simple as comparing two byte arrays against each other. The best method is to decode both elements that are to be compared with the same decoder, encode both objects with the same encoder, and then compare.

NOTE 3: As CBOR objects, JSON objects are not ordered, and a plain string comparison of two objects can not be performed.

File Structure

/schema/[semver].json
/COMMON/2DCode/raw/[Number].json
[COUNTRY]/2DCode/raw/[Number].json

Variables

COUNTRY is defined as the country code by ISO 3166.

Number must be a unique number by country/type.

JSON Schema

A number which identifies the used schema (used in the RAW Data).

RAW Content

The JSON Content under RAW is defined as:

{
   "JSON": **JSON OBJECT**,
   "CBOR": **CBOR (hex encoded)**,
   "COSE": **COSE (hex encoded)**,
   "COMPRESSED": **COMPRESSED (hex encoded)**,
   "BASE45": **BASE45 Encoded compressed COSE**,
   "PREFIX": **BASE45 Encoded compressed COSE with Prefix HC(x):**,
   "2DCODE": **BASE64 Encoded PNG**,
   "TESTCTX":{
       "VERSION": **integer**,
       "SCHEMA": **string (USED SCHEMA, semver)**,
       "CERTIFICATE": **BASE64** ,
       "VALIDATIONCLOCK": **Timestamp**, (https://docs.jsonata.org/date-time-functions ISO8601)
       "DESCRIPTION": **string**,
       "GATEWAY-ENV":**Array**
   },
   "EXPECTEDRESULTS": {
       "EXPECTEDVALIDOBJECT": **boolean**,
       "EXPECTEDSCHEMAVALIDATION": **boolean**,
       "EXPECTEDENCODE": **boolean**,
       "EXPECTEDDECODE": **boolean**,
       "EXPECTEDVERIFY": **boolean**,
       "EXPECTEDCOMPRESSION": **boolean**,
       "EXPECTEDKEYUSAGE": **boolean**,
       "EXPECTEDUNPREFIX": **boolean**,
       "EXPECTEDVALIDJSON": **boolean**,
       "EXPECTEDB45DECODE": **boolean**,
       "EXPECTEDPICTUREDECODE": **boolean**,
       "EXPECTEDEXPIRATIONCHECK": **boolean**,
    }
}

Example:

{
    "JSON": {
        "ver": "1.0.0",
        "nam": {
            "fn": "Musterfrau-Gößinger",
            "fnt": "MUSTERFRAU

Validation Content (TBD)

Javascript validation rules which must be passed during the testing of a 2D Code of the country. Each rule is applied on the decoded JSON Content. The function body is defined as

function [name] ([Decoded JSON Object]) {
    return [boolean]
}

Image Content

Contains images of the generated base45 contents(PNG).

Certificate Content

The public key to validate the data structure. This is defined as base64 encoded datastructure (PEM).

How to contribute

Contribution and feedback is encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines. By participating in this project, you agree to abide by its Code of Conduct at all times.

Licensing

Copyright (C) 2021 T-Systems International GmbH and all other contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.

Owner
Official GitHub Organization of the EU Digital COVID Certificates (EUDCC) project, previously known as the EU Digital Green Certificates (DGC).
RAT-el is an open source penetration test tool that allows you to take control of a windows machine.

To prevent RATel from being detected by antivirus, please do not upload the payload to TOTAL VIRUS. Each month I will test myself if the payload gets detected by antivirus. So you’ll have a photo eve

218 Dec 16, 2022
HTTP load generator, ApacheBench (ab) replacement, formerly known as rakyll/boom

hey is a tiny program that sends some load to a web application. hey was originally called boom and was influenced from Tarek Ziade's tool at tarekzia

Jaana Dogan 14.9k Jan 07, 2023
Plugin for generating HTML reports for pytest results

pytest-html pytest-html is a plugin for pytest that generates a HTML report for test results. Resources Documentation Release Notes Issue Tracker Code

pytest-dev 548 Dec 28, 2022
Avocado is a set of tools and libraries to help with automated testing.

Welcome to Avocado Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native test

Ana Guerrero Lopez 1 Nov 19, 2021
buX Course Enrollment Automation

buX automation BRACU - buX course enrollment automation Features: Automatically enroll into multiple courses at a time. Find courses just entering cou

Mohammad Shakib 1 Oct 06, 2022
CNE-OVS-SIT - OVS System Integration Test Suite

CNE-OVS-SIT - OVS System Integration Test Suite Introduction User guide Discussion Introduction CNE-OVS-SIT is a test suite for OVS end-to-end functio

4 Jan 09, 2022
WomboAI Art Generator

WomboAI Art Generator Automate AI art generation using wombot.art. Also integrated into SnailBot for you to try out. Setup Install Python Go to the py

nbee 7 Dec 03, 2022
자동 건강상태 자가진단 메크로 서버전용

Auto-Self-Diagnosis-for-server 자동 자가진단 메크로 서버전용 이 프로그램은 SaidBySolo님의 auto-self-diagnosis를 참고하여 제작하였습니다. 개인 사용 목적으로 제작하였기 때문에 추후 업데이트는 진행하지 않습니다. 의존성 G

JJooni 3 Dec 04, 2021
Test python asyncio-based code with ease.

aiounittest Info The aiounittest is a helper library to ease of your pain (and boilerplate), when writing a test of the asynchronous code (asyncio). Y

Krzysztof Warunek 55 Oct 30, 2022
BDD library for the py.test runner

BDD library for the py.test runner pytest-bdd implements a subset of the Gherkin language to enable automating project requirements testing and to fac

pytest-dev 1.1k Jan 09, 2023
Doggo Browser

Doggo Browser Quick Start $ python3 -m venv ./venv/ $ source ./venv/bin/activate $ pip3 install -r requirements.txt $ ./sobaki.py References Heavily I

Alexey Kutepov 9 Dec 12, 2022
Obsei is a low code AI powered automation tool.

Obsei is a low code AI powered automation tool. It can be used in various business flows like social listening, AI based alerting, brand image analysis, comparative study and more .

Obsei 782 Dec 31, 2022
Simple assertion library for unit testing in python with a fluent API

assertpy Simple assertions library for unit testing in Python with a nice fluent API. Supports both Python 2 and 3. Usage Just import the assert_that

19 Sep 10, 2022
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.

Mockoon Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source. It has been built wi

mockoon 4.4k Dec 30, 2022
Python Testing Crawler 🐍 🩺 🕷️ A crawler for automated functional testing of a web application

Python Testing Crawler 🐍 🩺 🕷️ A crawler for automated functional testing of a web application Crawling a server-side-rendered web application is a

70 Aug 07, 2022
An AWS Pentesting tool that lets you use one-liner commands to backdoor an AWS account's resources with a rogue AWS account - or share the resources with the entire internet 😈

An AWS Pentesting tool that lets you use one-liner commands to backdoor an AWS account's resources with a rogue AWS account - or share the resources with the entire internet 😈

Brandon Galbraith 276 Mar 03, 2021
PacketPy is an open-source solution for stress testing network devices using different testing methods

PacketPy About PacketPy is an open-source solution for stress testing network devices using different testing methods. Currently, there are only two c

4 Sep 22, 2022
FakeDataGen is a Full Valid Fake Data Generator.

FakeDataGen is a Full Valid Fake Data Generator. This tool helps you to create fake accounts (in Spanish format) with fully valid data. Within this in

Joel GM 64 Dec 12, 2022
masscan + nmap 快速端口存活检测和服务识别

masnmap masscan + nmap 快速端口存活检测和服务识别。 思路很简单,将masscan在端口探测的高速和nmap服务探测的准确性结合起来,达到一种相对比较理想的效果。 先使用masscan以较高速率对ip存活端口进行探测,再以多进程的方式,使用nmap对开放的端口进行服务探测。 安

starnightcyber 75 Dec 19, 2022