Git Product home page Git Product logo

dgca-app-core-android's Introduction

EU Digital COVID Certificate App Core - Android

AboutDevelopmentDocumentationSupportContributeContributorsLicensing

About

This repository contains the source code of the EU Digital COVID Certificate App Core for Android.

The app core provides shared functionality for the verifier and wallet apps.

Base module that provides functionality for handling DCC certificate type. It decodes the base45-encoded QR code, extracts the COSE signature, and decodes CBOR back to JSON. It then verifies the signature with the keys provided by the verifier/wallet app’s backend. The module uses only open-source libraries.

Documentation

Module features:

  • Prefix validation: Drops a country-specific prefix from contents, e.g. "HC1:"
  • Base45 Decoding: decodes provided input according to specification: Base45
  • Decompression with ZLIB
  • Decodes input according to COSE specification RFC8152
  • Decodes input as a CBOR structure
  • Schema validation - verifies CBOR with predefined schema (JsonSchema.kt#JSON_SCHEMA_V1)
  • Verifies COSE signature

For more details check unit tests to see how it works step by step.

Support and feedback

The following channels are available for discussions, feedback, and support requests:

Type Channel
Issues
Other requests

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.

Contributors

Our commitment to open source means that we are enabling -in fact encouraging- all interested parties to contribute and become part of its developer community.

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.

dgca-app-core-android's People

Contributors

daniel-eder avatar mykhailonester avatar oleksandrsarapulovgl avatar qmetzler-luna avatar rlatapy-luna avatar schulzesttsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dgca-app-core-android's Issues

Crash during schema validation when minifyEnabled=true

When executing schema validation using the dgca-app-core-android library and minifyEnabled=true the app crashes with this stacktrace:

I guess this library is not yet prepared for R8 code shrinking. I also included the dgca-app-code-android lib and got the same error.

Steps to reproduce the issue

Steps

  1. enable R8 code shrinking: minifyEnabled=true
  2. start Application
  3. scan QR Code
  4. Enter TAN -> Crash
2021-07-21 16:32:15.947 10614-10614/dgca.wallet.app.android E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dgca.wallet.app.android, PID: 10614
    java.lang.ExceptionInInitializerError
        at e.b.a.b.g.g.a.b(:53)
        at e.b.a.b.g.g.b.<clinit>(:58)
        at e.b.a.b.g.g.b.b(:48)
        at e.b.a.b.g.a.<clinit>(:35)
        at e.b.a.b.g.a.a(:45)
        at e.b.a.b.b.b.<clinit>(:63)
        at e.b.a.b.b.a.h(:97)
        at e.b.a.b.b.a.a(:107)
        at e.b.a.b.h.c.<init>(:68)
        at e.b.a.b.h.b.d(:123)
        at e.b.a.b.h.b.b(:113)
        at g.a.a.b.p.a.a(:53)
        at dgca.wallet.app.android.certificate.claim.ClaimCertificateViewModel$b$a.u(:96)
        at j.e0.j.a.a.i(:33)
        at k.a.r0.run(:106)
        at k.a.u2.a.Y(:571)
        at k.a.u2.a$b.c(:750)
        at k.a.u2.a$b.m(:678)
        at k.a.u2.a$b.run(:665)
     Caused by: java.lang.IllegalArgumentException: class "e.b.a.b.f.b.e.a" has no appropriate constructor (keyword "additionalItems"; expected a constructor with a JsonNode as an argument)
        at e.b.a.b.f.b.d.<init>(:31)
        at e.b.a.b.g.g.a.a(:125)
        at e.b.a.b.g.g.a.<clinit>(:68)
        at e.b.a.b.g.g.a.b(:53) 
        at e.b.a.b.g.g.b.<clinit>(:58) 
        at e.b.a.b.g.g.b.b(:48) 
        at e.b.a.b.g.a.<clinit>(:35) 
        at e.b.a.b.g.a.a(:45) 
        at e.b.a.b.b.b.<clinit>(:63) 
        at e.b.a.b.b.a.h(:97) 
        at e.b.a.b.b.a.a(:107) 
        at e.b.a.b.h.c.<init>(:68) 
        at e.b.a.b.h.b.d(:123) 
        at e.b.a.b.h.b.b(:113) 
        at g.a.a.b.p.a.a(:53) 
        at dgca.wallet.app.android.certificate.claim.ClaimCertificateViewModel$b$a.u(:96) 
        at j.e0.j.a.a.i(:33) 
        at k.a.r0.run(:106) 
        at k.a.u2.a.Y(:571) 
        at k.a.u2.a$b.c(:750) 
        at k.a.u2.a$b.m(:678) 
        at k.a.u2.a$b.run(:665)

Technical details

  • Device Pixel 2 (Android 11)

Possible Fix

I couldn't fix it but I started using these rules:

-keep public class dgca.verifier.app.decoder.model.*
-keep public class com.github.fge.jsonschema.** { *; }

JSON schema version 1.3 validation

Your Question

Thank you very much for your answer !

A certificate from the Ukrainian дія that results in an exception due to midle name.

I have Qr code, conteins next fields:
{4: 1666386000, 1: "UA", -260: {1: {"type": "local", "nam": {"gn": "Євгенія", "fnt": "SHEVTSOVA", "fn": "Шевцова", "mn": "Валеріївна", "gnt": "YEVHENIIA"}, "itn": "2830208121", "ver": "1.3.0", "dob": "1977-06-27", "v": [{"sd": 2, "mp": "EU/1/20/1528", "vp": "1119349007", "tg": "840539006", "dn": 2, "ci": "URN:UVCI:01:UA:7NV72MZWKJ1V1ZDG4ZGX2KMF", "is": "State Enterprise "DIIA"", "co": "UA", "dt": "2021-10-22", "ma": "ORG-100030215"}]}}, 6: 1634926088}

Main problem in "mn": "Валеріївна" field:
dgca/verifier/app/decoder/cbor/DefaultCborService.kt:70
Unrecognized field "mn" (class dgca.verifier.app.decoder.model.Person), not marked as ignorable
In class dgca-app-core-android/decoder/src/main/java/dgca/verifier/app/decoder/model/Person.kt
Has not field mn, and also it has not annotation @JsonIgnoreProperties(ignoreUnknown = true)
photo5420440524067813742

Base45Decoder should reject triplets representing integers greater than 65535

Describe the bug

https://datatracker.ietf.org/doc/html/draft-faltstrom-base45-07#section-6 says:

Even though a Base45 encoded string contains only characters from the alphabet in Table 1 the following case has to be considered: The string "FGW" represents 65535 (FFFF in base 16), which is a valid encoding. The string "GGW" would represent 65536 (10000 in base 16), which is represented by more than 16 bit.

Implementations MUST reject the encoded data if it contains a triplet of characters which, when decoded, results in an unsigned integer which is greater than 65535 (ffff in base 16).

But Base45Decoder accepts triplets representing integers greater than 65535, e.g. "GGW".

Expected behaviour

Base45Decoder().decode("GGW") should throw an exception, but returns a byte array with the bytes 0x01 0x00 0x00.

Steps to reproduce the issue

println(Base45Decoder().decode("GGW").joinToString(" ") { "%02X".format(it) }) prints 01 00 00.

Trimming JSON-fields for whitespaces

Current Implementation

Decoded JSON fields might contain whitespaces.
E.g. GR/EL QR Vaccination Codes in Field "mp"

Suggested Enhancement

During the CBOR Deserialization, all fields must be trimmed for whitespaces.

Release version in a public maven repository (like maven central)

Feature description

dgca app core provides a decoder that is useful to others. It would be great if it was provided in an easy consumable format like an artifact in a public maven repository.

Problem and motivation

By using a public maven repo, it's easy for downstream dependencies to keep up to date with any bugfixes etc.

Deps.json_validation_rhino declaration is missing

Describe the bug

Gradle build fails because Deps.json_validation_rhino is not declared in the buildSrc module.

Expected behaviour

I expected that cloning and building the project from main would work.

Steps to reproduce the issue

image

  1. Clone repo
  2. Open in Android Studio
  3. Initial build fails

Possible Fix

Add json_validation_rhino to Versions- and Dependencies-objects under buildSrc.

Unable to use dgca-app-core-android on Android 7 (24) devices

Hi,

I integrated your dgci-app-core-android library in my app which is minsdk 24 (Android 7).
Your decoder is working fine except on Android 7 devices.

What is the reason that your libraries minSDK is 26?
Is there a way to make it work for SDK 24 (Android 7) devices?

Thanks or your feedback!

Best regards
Robert

Update dependency json-schema-validator resolving dep. conflict with outdated transitives

Current Implementation

com.github.fge:json-schema-validator:2.2.6

This version depends on Guava v16.0.1.

Suggested Enhancement

com.github.java-json-tools:json-schema-validator:2.2.14

(this is the same project; at least v2.2.13 is needed)

Expected Benefits

Resolves a dependency conflict for Google Guava. Java-based apps often explicitly depend on current versions of Guava.

A problem occurred evaluating project ':decoder'

Hi when try to build it-dgc-verificaC19-android project I hev this error :
* Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':decoder'. ...... Caused by: groovy.lang.MissingPropertyException: No such property: desugar_jdk_libs for class: Deps

Any info? the dgca-app-core-android project is in the same root folder...

Regards

Date Format Support

Please support in the hCert the following dates:

1978-01-26T00:00:00
1987-12-12
1987-12
1987

Example: ^(19|20)\d\d(-\d\d){0,2}$

The schema currently just support the short version, therefore the others are failing during validation. Please relax the schema in this direction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.