From a98f9f2ca6bb62200cdf4315a60f2d2c01b3dc29 Mon Sep 17 00:00:00 2001
From: Felix Dittrich <31076102+f11h@users.noreply.github.com>
Date: Mon, 5 Sep 2022 15:47:44 +0200
Subject: [PATCH] Update Dependencies (#204)
Update Checkstyle to current version
Reformat all files
---
.github/workflows/ci-dependency-check.yml | 6 +-
.github/workflows/codeql.yml | 42 +-
.grenrc.js | 56 +-
CODE_OF_CONDUCT.md | 7 +-
CONTRIBUTING.md | 53 +-
README.md | 62 +-
codestyle/checkstyle.xml | 555 ++++++------
docs/software-design-dgc-gateway.md | 418 ++++++---
manifests/deployment.yml | 4 +-
manifests/service.yml | 14 +-
owasp/suppressions.xml | 40 +-
pom.xml | 35 +-
settings.xml | 16 +-
.../gateway/client/AssetManagerClient.java | 16 +-
.../gateway/entity/TrustedIssuerEntity.java | 1 -
.../SignerInformationRepository.java | 12 +-
.../repository/TrustedPartyRepository.java | 12 +-
.../CertificateMigrationController.java | 120 ++-
.../CertificateRevocationListController.java | 60 +-
.../controller/TrustListController.java | 77 +-
.../controller/ValidationRuleController.java | 39 +-
.../controller/ValuesetController.java | 17 +-
.../gateway/restapi/dto/TrustedIssuerDto.java | 2 +-
.../gateway/service/PublishingService.java | 8 +-
.../service/RevocationListService.java | 46 +-
.../SignerInformationCleanUpService.java | 2 +-
.../service/SignerInformationService.java | 30 +-
.../dgc/gateway/service/TrustListService.java | 34 +-
.../gateway/service/TrustedIssuerService.java | 24 +-
.../gateway/service/TrustedPartyService.java | 20 +-
.../service/ValidationRuleService.java | 24 +-
.../europa/ec/dgc/gateway/utils/CmsUtils.java | 24 +-
.../ec/dgc/gateway/utils/ListUtils.java | 4 +-
.../alter-signer-information-for-deletion.xml | 2 +-
.../changelog/fix-certificate-thumbprints.xml | 8 +-
src/main/resources/logback-spring.xml | 9 +-
.../publishing/ArchivePublishingTest.java | 111 ++-
.../CertificateMigrationControllerTest.java | 636 +++++++------
...tificateRevocationListIntegrationTest.java | 838 ++++++++++--------
.../CountryListIntegrationTest.java | 13 +-
.../SignerCertificateIntegrationTest.java | 164 ++--
.../controller/TrustListIntegrationTest.java | 104 ++-
.../ValidationRuleIntegrationTest.java | 556 +++++++-----
.../controller/ValuesetIntegrationTest.java | 35 +-
.../restapi/filter/CertAuthFilterTest.java | 60 +-
.../dgc/gateway/service/AuditServiceTest.java | 3 +-
.../service/RatValuesetUpdateServiceTest.java | 33 +-
.../SignerInformationCleanUpServiceTest.java | 56 +-
.../service/SignerInformationServiceTest.java | 182 ++--
.../gateway/service/TrustListServiceTest.java | 17 +-
.../service/TrustedIssuerServiceTest.java | 15 +-
.../service/TrustedPartyServiceTest.java | 61 +-
.../gateway/service/ValuesetServiceTest.java | 6 +-
.../testdata/CertificateTestUtils.java | 13 +-
.../dgc/gateway/testdata/DgcTestKeyStore.java | 9 +-
.../testdata/SignerInformationTestHelper.java | 1 +
.../testdata/TrustedIssuerTestHelper.java | 6 +-
.../testdata/TrustedPartyTestHelper.java | 19 +-
58 files changed, 2777 insertions(+), 2060 deletions(-)
diff --git a/.github/workflows/ci-dependency-check.yml b/.github/workflows/ci-dependency-check.yml
index 3031e3c9..47996d71 100644
--- a/.github/workflows/ci-dependency-check.yml
+++ b/.github/workflows/ci-dependency-check.yml
@@ -4,9 +4,9 @@ on:
- cron: '48 02 * * 0' # Each Sunday at 02:48 UTC
pull_request:
types:
- - opened
- - synchronize
- - reopened
+ - opened
+ - synchronize
+ - reopened
workflow_dispatch:
jobs:
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 79fa733d..3aa4ba9f 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -21,22 +21,22 @@ jobs:
language: [ 'java' ]
steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- languages: ${{ matrix.language }}
-
- - name: Setup Java 11
- uses: actions/setup-java@v2
- with:
- java-version: 11
- distribution: adopt
-
- - name: Build
- run: >-
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+
+ - name: Setup Java 11
+ uses: actions/setup-java@v2
+ with:
+ java-version: 11
+ distribution: adopt
+
+ - name: Build
+ run: >-
mvn clean package
--batch-mode
--file ./pom.xml
@@ -44,9 +44,9 @@ jobs:
--define app.packages.username="${APP_PACKAGES_USERNAME}"
--define app.packages.password="${APP_PACKAGES_PASSWORD}"
-DskipTests=true;
- env:
- APP_PACKAGES_USERNAME: ${{ github.actor }}
- APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
+ env:
+ APP_PACKAGES_USERNAME: ${{ github.actor }}
+ APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
diff --git a/.grenrc.js b/.grenrc.js
index e50821ee..c788f149 100644
--- a/.grenrc.js
+++ b/.grenrc.js
@@ -1,30 +1,30 @@
module.exports = {
- "dataSource": "prs",
- "prefix": "",
- "onlyMilestones": false,
- "groupBy": {
- "Enhancements": [
- "enhancement",
- "internal"
- ],
- "Bug Fixes": [
- "bug"
- ],
- "Documentation": [
- "documentation"
- ],
- "Others": [
- "other"
- ]
- },
- "changelogFilename": "CHANGELOG.md",
- "template": {
- commit: ({ message, url, author, name }) => `- [${message}](${url}) - ${author ? `@${author}` : name}`,
- issue: "- {{name}} [{{text}}]({{url}})",
- noLabel: "other",
- group: "\n#### {{heading}}\n",
- changelogTitle: "# Changelog\n\n",
- release: "## {{release}} ({{date}})\n{{body}}",
- releaseSeparator: "\n---\n\n"
- }
+ "dataSource": "prs",
+ "prefix": "",
+ "onlyMilestones": false,
+ "groupBy": {
+ "Enhancements": [
+ "enhancement",
+ "internal"
+ ],
+ "Bug Fixes": [
+ "bug"
+ ],
+ "Documentation": [
+ "documentation"
+ ],
+ "Others": [
+ "other"
+ ]
+ },
+ "changelogFilename": "CHANGELOG.md",
+ "template": {
+ commit: ({message, url, author, name}) => `- [${message}](${url}) - ${author ? `@${author}` : name}`,
+ issue: "- {{name}} [{{text}}]({{url}})",
+ noLabel: "other",
+ group: "\n#### {{heading}}\n",
+ changelogTitle: "# Changelog\n\n",
+ release: "## {{release}} ({{date}})\n{{body}}",
+ releaseSeparator: "\n---\n\n"
+ }
}
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index e1811e07..e8ae2ed2 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,4 +1,3 @@
-
# Contributor Covenant Code of Conduct
## Our Pledge
@@ -59,8 +58,8 @@ representative at an online or offline event.
## Enforcement
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported to the community leaders responsible for enforcement at
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
[opensource@telekom.de](mailto:opensource@telekom.de).
All complaints will be reviewed and investigated promptly and fairly.
@@ -107,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
-standards, including sustained inappropriate behavior, harassment of an
+standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d97f3776..6992aff4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,9 +4,11 @@
All members of the project community must abide by the [Contributor Covenant, version 2.0](CODE_OF_CONDUCT.md).
Only by respecting each other can we develop a productive, collaborative community.
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting [opensource@telekom.de](mailto:opensource@telekom.de) and/or a project maintainer.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
+contacting [opensource@telekom.de](mailto:opensource@telekom.de) and/or a project maintainer.
-We appreciate your courtesy of avoiding political questions here. Issues which are not related to the project itself will be closed by our community managers.
+We appreciate your courtesy of avoiding political questions here. Issues which are not related to the project itself
+will be closed by our community managers.
## Engaging in our project
@@ -14,19 +16,25 @@ We use GitHub to manage reviews of pull requests.
* If you are a new contributor, see: [Steps to Contribute](#steps-to-contribute)
-* If you have a trivial fix or improvement, go ahead and create a pull request, addressing (with `@...`) a suitable maintainer of this repository (see [CODEOWNERS](CODEOWNERS) of the repository you want to contribute to) in the description of the pull request.
+* If you have a trivial fix or improvement, go ahead and create a pull request, addressing (with `@...`) a suitable
+ maintainer of this repository (see [CODEOWNERS](CODEOWNERS) of the repository you want to contribute to) in the
+ description of the pull request.
-* If you plan to do something more involved, please reach out to us and send an [email](mailto:opensource@telekom.de). This will avoid unnecessary work and surely give you and us a good deal of inspiration.
+* If you plan to do something more involved, please reach out to us and send an [email](mailto:opensource@telekom.de).
+ This will avoid unnecessary work and surely give you and us a good deal of inspiration.
-* Relevant coding style guidelines are available in the respective sub-repositories as they are programming language-dependent.
+* Relevant coding style guidelines are available in the respective sub-repositories as they are programming
+ language-dependent.
## Steps to Contribute
-Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on. This is to prevent duplicated efforts from other contributors on the same issue.
+Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on.
+This is to prevent duplicated efforts from other contributors on the same issue.
If you have questions about one of the issues, please comment on them, and one of the maintainers will clarify.
-We kindly ask you to follow the [Pull Request Checklist](#Pull-Request-Checklist) to ensure reviews can happen accordingly.
+We kindly ask you to follow the [Pull Request Checklist](#Pull-Request-Checklist) to ensure reviews can happen
+accordingly.
## Contributing Code
@@ -36,7 +44,8 @@ The following rule governs code contributions:
* Contributions must be licensed under the [Apache 2.0 License](./LICENSE)
* Newly created files must be opened by an instantiated version of the file 'templates/file-header.txt'
-* At least if you add a new file to the repository, add your name into the contributor section of the file NOTICE (please respect the preset entry structure)
+* At least if you add a new file to the repository, add your name into the contributor section of the file NOTICE (
+ please respect the preset entry structure)
## Contributing Documentation
@@ -48,15 +57,22 @@ The following rule governs documentation contributions:
## Pull Request Checklist
-* Branch from the main branch and, if needed, rebase to the current main branch before submitting your pull request. If it doesn't merge cleanly with main you may be asked to rebase your changes.
+* Branch from the main branch and, if needed, rebase to the current main branch before submitting your pull request. If
+ it doesn't merge cleanly with main you may be asked to rebase your changes.
-* Commits should be as small as possible while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).
+* Commits should be as small as possible while ensuring that each commit is correct independently (i.e., each commit
+ should compile and pass tests).
-* Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests. If tested manually, provide information about the test scope in the PR description (e.g. “Test passed: Upgrade version from 0.42 to 0.42.23.”).
+* Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration
+ tests. If tested manually, provide information about the test scope in the PR description (e.g. “Test passed: Upgrade
+ version from 0.42 to 0.42.23.”).
-* Create _Work In Progress [WIP]_ pull requests only if you need clarification or an explicit review before you can continue your work item.
+* Create _Work In Progress [WIP]_ pull requests only if you need clarification or an explicit review before you can
+ continue your work item.
-* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review by contacting us via [email](mailto:opensource@telekom.de).
+* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking
+ for a review in the pull request or a comment, or you can ask for a review by contacting us
+ via [email](mailto:opensource@telekom.de).
* Post review:
* If a review requires you to change your commit(s), please test the changes again.
@@ -68,8 +84,13 @@ The following rule governs documentation contributions:
* We use GitHub issues to track bugs and enhancement requests.
-* Please provide as much context as possible when you open an issue. The information you provide must be comprehensive enough to reproduce that issue for the assignee. Therefore, contributors may use but aren't restricted to the issue template provided by the project maintainers.
+* Please provide as much context as possible when you open an issue. The information you provide must be comprehensive
+ enough to reproduce that issue for the assignee. Therefore, contributors may use but aren't restricted to the issue
+ template provided by the project maintainers.
-* When creating an issue, try using one of our issue templates which already contain some guidelines on which content is expected to process the issue most efficiently. If no template applies, you can of course also create an issue from scratch.
+* When creating an issue, try using one of our issue templates which already contain some guidelines on which content is
+ expected to process the issue most efficiently. If no template applies, you can of course also create an issue from
+ scratch.
-* Please apply one or more applicable [labels](/../../labels) to your issue so that all community members are able to cluster the issues better.
+* Please apply one or more applicable [labels](/../../labels) to your issue so that all community members are able to
+ cluster the issues better.
diff --git a/README.md b/README.md
index 9203ce54..7f7064ff 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,6 @@
Licensing
-
## About
This repository contains the source code of the EU Digital COVID Certificate Gateway (DGCG).
@@ -43,17 +42,23 @@ backend-to-backend integration is facilitated, and countries can onboard increme
retain flexibility and can control data processing of their users.
## Development
-Please be aware that the provided configuration files contain passwords that do not conform to any reasonable password policies, hence under no circumstances should be applied to productive or even broader test environments.
-Passwords used in productive scenarios should be provided only at runtime and stored in safe place, with restricted and logged access.
+
+Please be aware that the provided configuration files contain passwords that do not conform to any reasonable password
+policies, hence under no circumstances should be applied to productive or even broader test environments.
+Passwords used in productive scenarios should be provided only at runtime and stored in safe place, with restricted and
+logged access.
+
### Prerequisites
- OpenJDK 11 (with installed ```keytool``` CLI)
- Maven
-- Authenticate to [Github Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry)
+- Authenticate
+ to [Github Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry)
#### Authenticating to GitHub Packages
-As some of the required libraries (and/or versions are pinned/available only from GitHub Packages) You need to authenticate
+As some of the required libraries (and/or versions are pinned/available only from GitHub Packages) You need to
+authenticate
to [GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry)
The following steps need to be followed
@@ -127,8 +132,10 @@ afterwards the PublicKey has to be exported in a Java KeyStore.
keytool -importcert -alias dgcg_trust_anchor -file cert_ta.pem -keystore ta.jks -storepass dgcg-p4ssw0rd
```
-Put the created ta.jks file in the "certs" directory of dgc-gateway. If you are using the Docker image then this folder must
-be in the root directory of your local workspace (on the same level as this readme file). Create directory it does not already exist.
+Put the created ta.jks file in the "certs" directory of dgc-gateway. If you are using the Docker image then this folder
+must
+be in the root directory of your local workspace (on the same level as this readme file). Create directory it does not
+already exist.
#### Create Database
@@ -148,8 +155,9 @@ docker-compose up --build
`ERROR: for dgc-gateway_dgc-gateway_1 Cannot create container for service dgc-gateway`
-This error occurs in Docker-for-Windows if Docker does not have access to the gateway folder. In Docker-for-Windows,
-go to `Settings > Resources > File Sharing` and add the root directory of the repository, then restart Docker-for-Windows.
+This error occurs in Docker-for-Windows if Docker does not have access to the gateway folder. In Docker-for-Windows,
+go to `Settings > Resources > File Sharing` and add the root directory of the repository, then restart
+Docker-for-Windows.
#### Insert Trusted Parties
@@ -172,11 +180,13 @@ dgc ta sign -c cert_ta.pem -k key_ta.pem -i cert_csca.pem
dgc ta sign -c cert_ta.pem -k key_ta.pem -i cert_upload.pem
```
-Afterwards you can create a new entry in the `trusted_parties` table and fill all of the fields with the data produced by the above commands.
+Afterwards you can create a new entry in the `trusted_parties` table and fill all of the fields with the data produced
+by the above commands.
##### Inserting Trusted Parties into the Database
-Log on to the mysql container (using the docker commands or opening a shell with the docker UI) and open mysql cli like this:
+Log on to the mysql container (using the docker commands or opening a shell with the docker UI) and open mysql cli like
+this:
```
mysql --user=root --password=admin dgc
@@ -250,7 +260,7 @@ curl -X GET http://localhost:8080/trustList -H "accept: application/json" -H "X-
```
* Replace the example SHA with that of your own test certificate in the `X-SSL-Client-SHA256` header
-* Replace the example country with your own country in the `X-SSL-Client-DN` header (i.e. US, CN, ZA)
+* Replace the example country with your own country in the `X-SSL-Client-DN` header (i.e. US, CN, ZA)
That command will return something looking like this (but with large base64 strings)
@@ -305,7 +315,8 @@ Property, e.g. C=EU)
#### Coverting the certificate/private key into PKCS12
-Windows users may wish to convert their certificate/private keys into a PKCS12 package so that it can be imported into the
+Windows users may wish to convert their certificate/private keys into a PKCS12 package so that it can be imported into
+the
machine's certificate store. Thankfully that is pretty simple using openssl.
For example to convert the test authentication certificate created earlier:
@@ -338,18 +349,23 @@ The following channels are available for discussions, feedback, and support requ
| Type | Channel |
| ------------------------ | ------------------------------------------------------ |
-| **Gateway issues** | |
-| **Other requests** | |
+| **Gateway
+issues** | |
+| **Other
+requests** | |
-## How to contribute
+## 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](./CONTRIBUTING.md). By participating in this
+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](./CONTRIBUTING.md). By participating
+in this
project, you agree to abide by its [Code of Conduct](./CODE_OF_CONDUCT.md) at all times.
-## Contributors
+## 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.
+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
@@ -360,6 +376,8 @@ 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](./LICENSE) for the specific
+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](./LICENSE) for the
+specific
language governing permissions and limitations under the License.
diff --git a/codestyle/checkstyle.xml b/codestyle/checkstyle.xml
index ce3b135e..f12c8ee4 100644
--- a/codestyle/checkstyle.xml
+++ b/codestyle/checkstyle.xml
@@ -1,7 +1,7 @@
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/software-design-dgc-gateway.md b/docs/software-design-dgc-gateway.md
index fe7bf9b1..e014d6de 100644
--- a/docs/software-design-dgc-gateway.md
+++ b/docs/software-design-dgc-gateway.md
@@ -1,31 +1,44 @@
# Software Design EU Digital Green Certificates Gateway
+
by Michael Schulte (m.schulte@t-systems.com)
-## Introduction
+## Introduction
+
This documents describes detailed aspects of the implementation of the
-EU-digital-green-certificates Gateway. It is closely related to the document [trust-framework_interoperability_certificates](https://ec.europa.eu/health/sites/health/files/ehealth/docs/trust-framework_interoperability_certificates_en.pdf),
-to which describes the overarching framework and structure. The [European Digital Green Certificate Gateway](https://ec.europa.eu/health/sites/health/files/ehealth/docs/digital-green-certificates_v2_en.pdf) defines the gateway structure defines the high level architecture.
+EU-digital-green-certificates Gateway. It is closely related to the
+document [trust-framework_interoperability_certificates](https://ec.europa.eu/health/sites/health/files/ehealth/docs/trust-framework_interoperability_certificates_en.pdf)
+,
+to which describes the overarching framework and structure.
+The [European Digital Green Certificate Gateway](https://ec.europa.eu/health/sites/health/files/ehealth/docs/digital-green-certificates_v2_en.pdf)
+defines the gateway structure defines the high level architecture.
-Target audience for this document are software engineers who want to get a better understanding of the insight of the implementation to be able to contribute.
+Target audience for this document are software engineers who want to get a better understanding of the insight of the
+implementation to be able to contribute.
This document is not finished, feedback is welcome and will change its content.
+# Overview
+
+## Purpose of the Software System
+
+The Digital Green Certificate Gateway (DGCG) has the purpose to support the EU trust framework.
+It provides the operability to securely share validation and verification across the connected national backends.
+With the usage of DGCG Each national backend is free to distribute the keys via any preferred technology to support the
+national verification devices in the best way.
+If the Digital Green Certificate is in a correctly formatted 2D code, each verifier device can verify each code from
+other countries, if the verifier is connected to the backend (online verification) or if it has downloaded and stored
+the necessary public keys beforehand (offline verification).
-# Overview
-## Purpose of the Software System
-The Digital Green Certificate Gateway (DGCG) has the purpose to support the EU trust framework.
-It provides the operability to securely share validation and verification across the connected national backends.
-With the usage of DGCG Each national backend is free to distribute the keys via any preferred technology to support the national verification devices in the best way.
-If the Digital Green Certificate is in a correctly formatted 2D code, each verifier device can verify each code from other countries, if the verifier is connected to the backend (online verification) or if it has downloaded and stored the necessary public keys beforehand (offline verification).
+## Core Entities
-## Core Entities
-|Entity| Definition|
+|Entity| Definition|
| ------------- |:-------------:|
| trusted_party | stores the certificate for the trusted parties|
| signer_information | stores the certificate for the signer |
| audit_event | stores all events happening in the system |
# Context View
+
The diagram below shows the api endpoints from the DGC Gateway and the dataflow from and to national backends.
![Data Flow View](DGCG-Overview.png "API Overview")
National Health Authorities acting the certificate management process.
@@ -33,70 +46,97 @@ National Health Authorities acting the certificate management process.
# Software Design
## Communication
+
This is a condesed overview of the comminication of the DGCG
+
### Triangle of Trust
-The triangle of trust is the blueprint for Green Certificate interoperability:
--**Holder**: A Green Certificate (DGC) owner (i.e., a citizen with a vaccination, negative PCR test result, or positive anti-body test result)—note that the Green Certificate can be held digitally within a wallet app or on paper (or both)
--**Issuer**: A national authority
+
+The triangle of trust is the blueprint for Green Certificate interoperability:
+-**Holder**: A Green Certificate (DGC) owner (i.e., a citizen with a vaccination, negative PCR test result, or positive
+anti-body test result)—note that the Green Certificate can be held digitally within a wallet app or on paper (or both)
+-**Issuer**: A national authority
-**Verifier**: An offline/online verifier (e.g., customs officers, police, or hotel staff)
![triangle_of_trust.png](triangle_of_trust.png)
-How does the verifier know which issuer is trustworthy? In a personal relationship, one would decide by experience. In this architecture, the DGCG tells the verifier which issuers are trustworthy by providing cryptographically anchored information.
+How does the verifier know which issuer is trustworthy? In a personal relationship, one would decide by experience. In
+this architecture, the DGCG tells the verifier which issuers are trustworthy by providing cryptographically anchored
+information.
+
### Distribution of Verification Information
-Exactly how each national app communicates with the corresponding national backend -whether via CDN, active push, or otherwise - is left to each country. Important here is the cryptographically secured E2E protection between the member states.
+
+Exactly how each national app communicates with the corresponding national backend -whether via CDN, active push, or
+otherwise - is left to each country. Important here is the cryptographically secured E2E protection between the member
+states.
![distribution_of_signing.png](distribution_of_signing.png)
+
### Communication ways
-- Device-to-device communication is built on a standardized 2D code and verifier format defined by the EU Trust Framework.
-- A direct backend-to-backend communication is not necessary, because the main purpose of the DGCG solution is to provide verification information.
+
+- Device-to-device communication is built on a standardized 2D code and verifier format defined by the EU Trust
+ Framework.
+- A direct backend-to-backend communication is not necessary, because the main purpose of the DGCG solution is to
+ provide verification information.
+
### Trust
-To ensure that just data from trusted parties are accepted. The system contains a trust list which is signed entry by entry air gapped by an official signer. This signer, signs with his private key each request of onboarding and provides this signed information to the DGCG operator which can set this entry on the trust list. This guarantees that no external attacker or another party than the trusted signer can create valid records for the trust list. The public key of the trusted signer is shared out of band to the other parties, to establish an effective trust anchoring.
+
+To ensure that just data from trusted parties are accepted. The system contains a trust list which is signed entry by
+entry air gapped by an official signer. This signer, signs with his private key each request of onboarding and provides
+this signed information to the DGCG operator which can set this entry on the trust list. This guarantees that no
+external attacker or another party than the trusted signer can create valid records for the trust list. The public key
+of the trusted signer is shared out of band to the other parties, to establish an effective trust anchoring.
![trust.png](trust.png)
## Interfaces
+
DGCG provides a simple REST API with common upload and download functionality for trusted information.
![api.png](api.png)
-The are described further with a OpenAPI doc and in the document [European Digital Green Certificate Gateway](https://ec.europa.eu/health/sites/health/files/ehealth/docs/digital-green-certificates_v2_en.pdf)
+The are described further with a OpenAPI doc and in the
+document [European Digital Green Certificate Gateway](https://ec.europa.eu/health/sites/health/files/ehealth/docs/digital-green-certificates_v2_en.pdf)
## Database Design
###Trusted Party Table
-| Field | Description | Data Type |
-| -------------- | ------------------------------------------------ | ------------------------------------------------ |
-| Id | Primary key | Long |
-| Timestamp | Timestamp of the Record | Timestamp |
-| Country | Country Code | varchar(2) |
-| Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
+| Field | Description | Data Type |
+| -------------- | ------------------------------------------------ | ------------------------------------------------ |
+| Id | Primary key | Long |
+| Timestamp | Timestamp of the Record | Timestamp |
+| Country | Country Code | varchar(2) |
+| Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
| Certificate Type | Type of the certificate (Authentication, Signing, Issuer, Client, CSCA) | varchar(*) |
-| RawData | Raw Data of the certificate | binary|
-| Signature | Signature of the Trust Anchor | varchar(*) |
-The cerificate type is one of the following
+| RawData | Raw Data of the certificate | binary|
+| Signature | Signature of the Trust Anchor | varchar(*) |
+The cerificate type is one of the following
+
- **Authentication** Certificate which the member state is using to authenticate at DGCG (NBTLS)
- **Upload** Certificate which the member state is using to sign the uploaded information’s (NBUS)
- **CSCA** Country Signing Certificate Authority certificate (NBCSCA)
###Signer Information Table
-| Field | Description | Data Type |
-| -------------- | ------------------------------------------------ | ------------------------------------------------ |
-| Id | Primary key | Long |
-| Timestamp | Timestamp of the Record | Timestamp |
-| Country | Country Code | varchar(2) |
-| Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
+| Field | Description | Data Type |
+| -------------- | ------------------------------------------------ | ------------------------------------------------ |
+| Id | Primary key | Long |
+| Timestamp | Timestamp of the Record | Timestamp |
+| Country | Country Code | varchar(2) |
+| Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
| Certificate Type | Type of the certificate (Authentication, Signing, Issuer, Client, CSCA) | varchar(*) |
-| RawData | Raw Data of the certificate | binary|
-| Signature | Signature of the Trust Anchor | varchar(*) |
-The cerificate type is one of the following
+| RawData | Raw Data of the certificate | binary|
+| Signature | Signature of the Trust Anchor | varchar(*) |
+The cerificate type is one of the following
+
- **DSC** Certificate which the member state is using to sign documents (NBDSC)
-###Audit Event Table
-| Field | Description | Data Type |
-| -------------- | ------------------------------------------------ | ------------------------------------------------ |
-| Id | Primary key | Long |
-| Timestamp | Timestamp of the Record | Timestamp |
-| Country | Country Code | varchar(2) |
-| Uploader Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
-| Authentication Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
-| Event | Event which occurs | binary|
-| Description | Description of the Event | varchar(*) |
-The Rights on the table are restricted to insert only for the application user to restrict manipulation of the audit events.
-The following table will contain all Audit Events. It is currently under implementation, so the list will be filled after.
+ ###Audit Event Table
+ | Field | Description | Data Type |
+ | -------------- | ------------------------------------------------ | ------------------------------------------------
+ |
+ | Id | Primary key | Long |
+ | Timestamp | Timestamp of the Record | Timestamp |
+ | Country | Country Code | varchar(2) |
+ | Uploader Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
+ | Authentication Sha256Fingerprint | SHA256-fingerprint of the certificate | varchar(*) |
+ | Event | Event which occurs | binary|
+ | Description | Description of the Event | varchar(*) |
+ The Rights on the table are restricted to insert only for the application user to restrict manipulation of the audit
+ events.
+ The following table will contain all Audit Events. It is currently under implementation, so the list will be filled
+ after.
| Event | Description |
| -------------- | ------------------------------------------------ |
@@ -127,9 +167,12 @@ This is a List of all Possible Problem Reports that can be returned.
| 0x299 | Unexpected Error | Not available | Ask Support for help |
## Monitoring
+
## Audit Logging
-The purpose of the audit logging is to track the usage of the system.
+
+The purpose of the audit logging is to track the usage of the system.
The audit events will be additionally logged into the application log.
+
### Log File Structure
The target environment for this service is an Apache Tomcat Server. So all log output will be written to stdout
@@ -137,13 +180,16 @@ which is redirected to `catalina.out` log file. So the content of this file need
### Log Message Structure
-All log messages are following one format. The log format is inspired by the Splunk best practices document ([link](https://dev.splunk.com/enterprise/docs/developapps/addsupport/logging/loggingbestpractices/))
+All log messages are following one format. The log format is inspired by the Splunk best practices
+document ([link](https://dev.splunk.com/enterprise/docs/developapps/addsupport/logging/loggingbestpractices/))
Each log message contains key value pairs which will represent the required data.
-All of these log messages are consisting of mandatory and additional fields. The mandatory fields are always at the beginning of a log message.
- The key value pairs are connected by a "=" and seperated by "," followed by a space. If the value consists of more than one word, the value will be wrapped within double quotes.
- Multiple log messages are seperated by a new line.
- The following mandatory fields will be sent with each log message:
+All of these log messages are consisting of mandatory and additional fields. The mandatory fields are always at the
+beginning of a log message.
+The key value pairs are connected by a "=" and seperated by "," followed by a space. If the value consists of more than
+one word, the value will be wrapped within double quotes.
+Multiple log messages are seperated by a new line.
+The following mandatory fields will be sent with each log message:
| Field | Content | Example Value |
| ---------- | ------------------------------------------------ | -------------------------------------- |
@@ -159,15 +205,17 @@ All of these log messages are consisting of mandatory and additional fields. The
| exception | Stack Trace, if available | org.springframew... |
Example:
+
```
timestamp="2020-08-04 17:19:46.038", level=INFO, pid=44929, traceId=e7d394f3b0431c68, spanId=e7d394f3b0431c68, thread=scheduling-1, class=e.i.f.service.SignerInformationService, message="Uploaded certificate already exist", exception=""
```
*exception field will only be written to log file. In console stack traces will be printed directly.
-These key-value-pairs can be followed by additional attributes. The additional attributes are individual for each log message.
+These key-value-pairs can be followed by additional attributes. The additional attributes are individual for each log
+message.
-### Log messages
+### Log messages
| Event | Log Level | Log Message | Additional attributes |
| ----- | --------- | ----------- | --------------------- |
@@ -222,35 +270,45 @@ The load balancer terminates TLS, executes the mutual TLS authentication and for
The IP of the load balancer is assigned to registered domain name.
To allow authentication of the http request the load balancer adds header
- attributes containing meta information about the client certificate used to
- authenticate the request.
-
+attributes containing meta information about the client certificate used to
+authenticate the request.
## Reverse Proxy
-The reverse proxy distributes load over the tomcat instances.
+
+The reverse proxy distributes load over the tomcat instances.
The main purpose for EDGCGS is to provide fail over behavior in case a tomcat instance is not available anymore.
## Database
+
The database is implemented as mySQL 5.7
## Log Analytics/Monitoring Integration
## Secret Management
-Environment specific secrets are managed as part of the tomcat configuration. JDBC connections are provided as tomcat resources.
+
+Environment specific secrets are managed as part of the tomcat configuration. JDBC connections are provided as tomcat
+resources.
# Security
-In this section, we define the security concept and security requirements for the DGCG Gateway. The meaning of the words "MUST", "MAY", and "SHOULD" is defined in [RFC 2119](https://tools.ietf.org/html/rfc2119). To each requirement, an identifier, in the format "SecReq-{Number}", is assigned.
+In this section, we define the security concept and security requirements for the DGCG Gateway. The meaning of the
+words "MUST", "MAY", and "SHOULD" is defined in [RFC 2119](https://tools.ietf.org/html/rfc2119). To each requirement, an
+identifier, in the format "SecReq-{Number}", is assigned.
-## 1. Definitions
+## 1. Definitions
-**Client**: It refers to a National Backend (see [DGCG Gateway Architecture Specification](https://ec.europa.eu/health/sites/health/files/ehealth/docs/trust-framework_interoperability_certificates_en.pdf)) that uploads or downloads to/from the DGCG Gateway. In the section "Client Authentication", Client and National Backend are used interchangeably.
+**Client**: It refers to a National Backend (
+see [DGCG Gateway Architecture Specification](https://ec.europa.eu/health/sites/health/files/ehealth/docs/trust-framework_interoperability_certificates_en.pdf))
+that uploads or downloads to/from the DGCG Gateway. In the section "Client Authentication", Client and National Backend
+are used interchangeably.
**DGCG Gateway Components**
-* **Load Balancer**: The component that receives the clients' requests (e.g., signerCertificate , trustList or audit) and forwards them to the DGCG Gateway Service after successful execution of the TLS protocol.
+* **Load Balancer**: The component that receives the clients' requests (e.g., signerCertificate , trustList or audit)
+ and forwards them to the DGCG Gateway Service after successful execution of the TLS protocol.
-* **Service**: The component that processes the clients' requests (e.g., signerCertificate , trustList or audit) after successful client authentication.
+* **Service**: The component that processes the clients' requests (e.g., signerCertificate , trustList or audit) after
+ successful client authentication.
* **Database**: The component where the information (e.g., thumbprint) of the clients' certificates is stored.
@@ -261,180 +319,239 @@ In this section, we define the security concept and security requirements for th
- **CSCA** Country Signing Certificate Authority certificate (NBCSCA)
- **DSC** Certificate which the member state is using to sign documents (NBDSC)
-**Batch Signature**: A [PKCS#7](https://tools.ietf.org/html/rfc5652) object containing, among others, the signature of a diagnosis key batch and the Signing Certificate.
+**Batch Signature**: A [PKCS#7](https://tools.ietf.org/html/rfc5652) object containing, among others, the signature of a
+diagnosis key batch and the Signing Certificate.
-**Client Authentication**: The process in which a Client is authenticated (using its Authentication Certificate) and authorized to request signerCertificate , trustList or audit.
+**Client Authentication**: The process in which a Client is authenticated (using its Authentication Certificate) and
+authorized to request signerCertificate , trustList or audit.
-**Certificate Thumbprint/Fingerprint**: Hash value of a certificate. We have defined the SHA-256 hash function for calculation of the fingerprint. In this document, certificate hash, certificate fingerprint, and certificate thumbprint are used interchangeably.
+**Certificate Thumbprint/Fingerprint**: Hash value of a certificate. We have defined the SHA-256 hash function for
+calculation of the fingerprint. In this document, certificate hash, certificate fingerprint, and certificate thumbprint
+are used interchangeably.
##Client Authentication
-As shown in the figure below, the Ditital Green Certificate Gateway Load Balancer authenticates the Clients (National Databases) via mTLS. Then, the clients' requests are forwarded to the DGCG , which validates the Client Authentication Certificate against a whitelist stored in the database. Once the certificate has been successfully verified, the DGCG passes the requests to the corresponding endpoints (e.g., signerCertificate , trustList or audit).
+As shown in the figure below, the Ditital Green Certificate Gateway Load Balancer authenticates the Clients (National
+Databases) via mTLS. Then, the clients' requests are forwarded to the DGCG , which validates the Client Authentication
+Certificate against a whitelist stored in the database. Once the certificate has been successfully verified, the DGCG
+passes the requests to the corresponding endpoints (e.g., signerCertificate , trustList or audit).
-**SecReq-001** All the clients' requests (e.g., upload diagnostic key batch) MUST be authenticated.
+**SecReq-001** All the clients' requests (e.g., upload diagnostic key batch) MUST be authenticated.
###Load Balancer
-**SecReq-002** The Load Balancer MUST perform mutual TLS (mTLS) with the clients (national backends).
+**SecReq-002** The Load Balancer MUST perform mutual TLS (mTLS) with the clients (national backends).
**SecReq-003** The Load Balancer MUST implement TLS termination.
####Certificate Validation
-**SecReq-004** If the client's certificate is not sent during the TLS handshake protocol, the Load Balancer MUST reject the client's request.
+**SecReq-004** If the client's certificate is not sent during the TLS handshake protocol, the Load Balancer MUST reject
+the client's request.
-**SecReq-005** If the client's certificate has expired, the Load Balancer MUST reject the client's request. The expiration is determined by the “notAfter” field (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-22)) of the certificate.
+**SecReq-005** If the client's certificate has expired, the Load Balancer MUST reject the client's request. The
+expiration is determined by the “notAfter” field (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-22)) of the
+certificate.
-**SecReq-006** The Load Balancer MUST maintain a bundle containing the root CA certificates or intermediate CA certificates needed to verify (trust) the clients' authentication certificates. If a national backend uses a self-signed client authentication certificate, this certificate MUST be added to the CA bundle.
+**SecReq-006** The Load Balancer MUST maintain a bundle containing the root CA certificates or intermediate CA
+certificates needed to verify (trust) the clients' authentication certificates. If a national backend uses a self-signed
+client authentication certificate, this certificate MUST be added to the CA bundle.
-**SecReq-007** The Load Balancer MUST validate the client's certificate chain using its CA bundle (SecReq-006). If validation fails, the Load Balancer MUST reject the client's request.
+**SecReq-007** The Load Balancer MUST validate the client's certificate chain using its CA bundle (SecReq-006). If
+validation fails, the Load Balancer MUST reject the client's request.
-**SecReq-008** The Load Balancer MAY maintain a Certificate Revocation List (CRL) (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-54)).
+**SecReq-008** The Load Balancer MAY maintain a Certificate Revocation List (CRL) (
+see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-54)).
-**SecReq-009** If SecReq-008 is fulfilled, the Load Balancer MUST reject a request, if the client's certificate is present in the CRL.
+**SecReq-009** If SecReq-008 is fulfilled, the Load Balancer MUST reject a request, if the client's certificate is
+present in the CRL.
####Request Forwarding
-**SecReq-010** If the client's certificate was successfully validated, the Load Balancer MUST forward the corresponding request to the DGCG Service via HTTP.
+**SecReq-010** If the client's certificate was successfully validated, the Load Balancer MUST forward the corresponding
+request to the DGCG Service via HTTP.
-**SecReq-011** When a client's request is forwarded to the DGCG Service (See SecReq-010), the Load Balancer MUST add the following HTTP headers to the request:
+**SecReq-011** When a client's request is forwarded to the DGCG Service (See SecReq-010), the Load Balancer MUST add
+the following HTTP headers to the request:
| HTTP Header | Description |
|---------------------|-------------|
-| X-SSL-Client-SHA256 | SHA-256 hash value of the DER encoded client's certificate. The so-called certificate fingerprint or thumbprint. (base64 encoded bytes, not base64 encoded hexadecimal string representation) |
-| X-SSL-Client-DN | The subject Distinguished Name (DN) of the client's certificate (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-23) and [RFC 1719](https://tools.ietf.org/html/rfc1779#page-6)). The DN MUST contain the Country (C) attribute. (it is possible to transmit DN string URL encoded) |
+| X-SSL-Client-SHA256 | SHA-256 hash value of the DER encoded client's certificate. The so-called certificate fingerprint or thumbprint. (base64 encoded bytes, not base64 encoded hexadecimal string representation) |
+| X-SSL-Client-DN | The subject Distinguished Name (DN) of the client's certificate (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-23) and [RFC 1719](https://tools.ietf.org/html/rfc1779#page-6)). The DN MUST contain the Country (C) attribute. (it is possible to transmit DN string URL encoded) |
-###Ditital Green Certificate Gateway Service
+###Ditital Green Certificate Gateway Service
-**SecReq-012** The Ditital Green Certificate Gateway (DGCG) Service MUST authenticate the clients' requests using the information sent in the HTTP requests (see SecReq-011) and the certificate information stored in the DGCG Database.
+**SecReq-012** The Ditital Green Certificate Gateway (DGCG) Service MUST authenticate the clients' requests using the
+information sent in the HTTP requests (see SecReq-011) and the certificate information stored in the DGCG Database.
**SecReq-013** To authenticate a client, the DGCG Service MUST perform the following steps:
-1. Extract the value of the *X-SSL-Client-SHA256* and *X-SSL-Client-DN* headers from the HTTP request forwarded by the Load Balancer (see SecReq-011).
+1. Extract the value of the *X-SSL-Client-SHA256* and *X-SSL-Client-DN* headers from the HTTP request forwarded by the
+ Load Balancer (see SecReq-011).
2. Extract the Country (C) attribute from the X-SSL-Client-DN value.
-3. Query the DGCG Database using the X-SSL-Client-SHA256 value and the Country (C) attribute. Also, the certificate type (see SecReq-019) MUST be used in the query. In this case, the type is: AUTHENTICATION.
+3. Query the DGCG Database using the X-SSL-Client-SHA256 value and the Country (C) attribute. Also, the certificate
+ type (see SecReq-019) MUST be used in the query. In this case, the type is: AUTHENTICATION.
- 1. If the query does not return any record, the DGCG Service MUST reject the client's request.
+ 1. If the query does not return any record, the DGCG Service MUST reject the client's request.
- 2. If the query returns a record, the DGCG Service MUST check whether the certificate has not been revoked. If the certificate was already revoked, the DGCG Service MUST reject the request. Otherwise continue with step 4.
+ 2. If the query returns a record, the DGCG Service MUST check whether the certificate has not been revoked. If the
+ certificate was already revoked, the DGCG Service MUST reject the request. Otherwise continue with step 4.
-4. If the client’s request was authenticated successfully, the DGCG Service MUST forward the request to the corresponding endpoint (e.g., download or upload endpoint).
+4. If the client’s request was authenticated successfully, the DGCG Service MUST forward the request to the
+ corresponding endpoint (e.g., download or upload endpoint).
####Logging
-**SecReq-014** The DGCG Service MUST log each authentication attempt using the information of the X-SSL-Client-DN header.
+**SecReq-014** The DGCG Service MUST log each authentication attempt using the information of the X-SSL-Client-DN
+header.
+
+**SecReq-015** The DGCG Service MUST use the log format defined by the Cyber Defense Center (CDC) **TODO:TBD**.
-**SecReq-015** The DGCG Service MUST use the log format defined by the Cyber Defense Center (CDC) **TODO:TBD**.
-
###Storing Secrets
The service has two secrets which need special handling during storage
+
- private key of DGCGTLS for outgoing TLS connections (for call back), to allow mTLS authentication
-- public key of DGCGTA Trust Anchor
+- public key of DGCGTA Trust Anchor
-These keys need to be stored seperate from the database. They are stored in two different Java KeyStore (https://en.wikipedia.org/wiki/Java_KeyStore) and deployed manually to the Tomcat instances. The keystores are protected with a password, the password is set as JVM property.
+These keys need to be stored seperate from the database. They are stored in two different Java
+KeyStore (https://en.wikipedia.org/wiki/Java_KeyStore) and deployed manually to the Tomcat instances. The keystores are
+protected with a password, the password is set as JVM property.
### Certificate Verification during OnBoarding
-Note that the onboarding process is *not* part of the DGCG Gateway (software). It is included here to inform the future operators of the EDGCGS and the operators of the member-states of key technical steps. The entire onboarding process will be defined separately as part of the overall e-Health network process.
+Note that the onboarding process is *not* part of the DGCG Gateway (software). It is included here to inform the future
+operators of the EDGCGS and the operators of the member-states of key technical steps. The entire onboarding process
+will be defined separately as part of the overall e-Health network process.
-**SecReq-023** The Ditital Green Certificate Gateway (DGCG) upload endpoint MUST validate the Signing Certificate, which is sent in the PKCS#7 object (see SecReq-017), based on the requirements specified below. The file format is PKCS#12 (pfx) with a password. The password is communicated by to the DGCG by the Designated Country Technical Contact (DCTC) during a verification call where the DGCG contacts the DCTC to verify the authenticity of the upload and get the password.
+**SecReq-023** The Ditital Green Certificate Gateway (DGCG) upload endpoint MUST validate the Signing Certificate,
+which is sent in the PKCS#7 object (see SecReq-017), based on the requirements specified below. The file format is
+PKCS#12 (pfx) with a password. The password is communicated by to the DGCG by the Designated Country Technical Contact (
+DCTC) during a verification call where the DGCG contacts the DCTC to verify the authenticity of the upload and get the
+password.
-**SecReq-###** The Relative Distinguished Name(RDN) 'C' in the Distinguished Name (DN) must match the country of the the Country.
+**SecReq-###** The Relative Distinguished Name(RDN) 'C' in the Distinguished Name (DN) must match the country of the the
+Country.
**SecReq-###** The RDN 'emailAddress' in the Distinguished Name (DN) must match the 24x7 email address of the Country.
-**SecReq-###** The RNDs CN, O and (optional OU) should be populated with a set of human readable and operationally correct set of values. Such as '/CN=DGCGS Netherlands/OU=National Health Institute/O=Ministry of Public Health/C=NL'.
+**SecReq-###** The RNDs CN, O and (optional OU) should be populated with a set of human readable and operationally
+correct set of values. Such as '/CN=DGCGS Netherlands/OU=National Health Institute/O=Ministry of Public Health/C=NL'.
**SecReq-###** The PKCS#12 (pfx) Should contain the complete chain, where applicable.
-**SecReq-###** If the Signing Certificate should be valid for at least 3 (more) month. The expiration is determined by the "notAfter" field (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-22)) of the certificate.
+**SecReq-###** If the Signing Certificate should be valid for at least 3 (more) month. The expiration is determined by
+the "notAfter" field (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-22)) of the certificate.
-**SecReq-###** The DGCG upload endpoint MUST verify the signature of the Signing Certificate. If validation failed, the DGCG upload endpoint MUST abort Onboarding..
+**SecReq-###** The DGCG upload endpoint MUST verify the signature of the Signing Certificate. If validation failed, the
+DGCG upload endpoint MUST abort Onboarding..
-**SecReq-###** In order to ensure maximum interoperability in a short timeline fields such as the Key Usage, Extended Key Usage will be operationally *ignored*.
+**SecReq-###** In order to ensure maximum interoperability in a short timeline fields such as the Key Usage, Extended
+Key Usage will be operationally *ignored*.
**SecReq-###** The X.509 certificate will be of version X.509 v3 (RFC5280).
-**SecReq-###** The key-lengths will meet or exceed the BSI Recommendations(2020) and the ECRYPT-CSA Recommendations(2018) for near term production: 3072 bits (RSA) or 256 bits (EC) and SHA256.
+**SecReq-###** The key-lengths will meet or exceed the BSI Recommendations(2020) and the ECRYPT-CSA Recommendations(
+
+2018) for near term production: 3072 bits (RSA) or 256 bits (EC) and SHA256.
### Certificate Verification during subsequent use and Upload
-Digital Green Certificate Gateway (DGCG) upload endpoint MUST validate the Signing Certificate.
-**SecReq-###** If the Signing Certificate has expired, the DGCG upload endpoint MUST reject the upload request. The expiration is determined by the "notAfter" field (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-22)) of the certificate.
+**SecReq-###** If the Signing Certificate has expired, the DGCG upload endpoint MUST reject the upload request. The
+expiration is determined by the "notAfter" field (see [RFC 5280](https://tools.ietf.org/html/rfc5280#page-22)) of the
+certificate.
-**SecReq-###** The DGCG upload endpoint MUST verify the signature of the Signing Certificate. If validation failed, the DGCG upload endpoint MUST reject the upload request.
+**SecReq-###** The DGCG upload endpoint MUST verify the signature of the Signing Certificate. If validation failed, the
+DGCG upload endpoint MUST reject the upload request.
-**SecReq-026** To verify whether a Signing Certificate is whitelisted, the DGCG upload endpoint MUST execute the next steps:
+**SecReq-026** To verify whether a Signing Certificate is whitelisted, the DGCG upload endpoint MUST execute the next
+steps:
-1. Extract the *Origin* value from the
+1. Extract the *Origin* value from the
2. Extract the *Country (C)* attribute from the X-SSL-Client-DN request header (see SecReq-011).
-3. Compare the *Origin* with the *Country*.
+3. Compare the *Origin* with the *Country*.
- 1. If the Origin is not equal to Country, the upload endpoint MUST reject the signature, and thus, reject the upload request. Otherwise, continue with step 4.
+ 1. If the Origin is not equal to Country, the upload endpoint MUST reject the signature, and thus, reject the upload
+ request. Otherwise, continue with step 4.
4. Extract the signing certificate (DER encoded) from the PKCS#7 object.
5. Calculate the SHA-256 value of the extracted signing certificate.
-6. Query the DGCG Database using the calculated SHA-256 value and the Country (C) attribute. Also, the certificate type (see SecReq-028) MUST be used in the query. In this case, the type is: SIGNING.
-
- 1. If the query does not return any record, the upload endpoint MUST reject the signature, and thus, reject the upload request.
+6. Query the DGCG Database using the calculated SHA-256 value and the Country (C) attribute. Also, the certificate
+ type (see SecReq-028) MUST be used in the query. In this case, the type is: SIGNING.
- 2. If the query returns a record, the upload endpoint MUST verify that the certificate has not been revoked. If the certificate was already revoked, the upload endpoint MUST reject the signature, and thus, reject the upload request.
+ 1. If the query does not return any record, the upload endpoint MUST reject the signature, and thus, reject the
+ upload request.
+ 2. If the query returns a record, the upload endpoint MUST verify that the certificate has not been revoked. If the
+ certificate was already revoked, the upload endpoint MUST reject the signature, and thus, reject the upload
+ request.
-## Certificate Requirements
+## Certificate Requirements
-**SecReq-033** All certificates MUST be complied with the X.509 version 3 certificate standard (see [RFC 5280](https://tools.ietf.org/html/rfc5280)).
+**SecReq-033** All certificates MUST be complied with the X.509 version 3 certificate standard (
+see [RFC 5280](https://tools.ietf.org/html/rfc5280)).
**SecReq-034** All certificates MUST contain a Distinguished Name (DN) in the subject field.
-**SecReq-035** The Distinguished Name (DN) MUST have the Country (C) attribute, containing the [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) (e.g., NL) of the National Backend.
+**SecReq-035** The Distinguished Name (DN) MUST have the Country (C) attribute, containing
+the [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) (e.g., NL) of the
+National Backend.
--The Signing Certificates, which are used to verify the batch signature, CAN be self-signed. (this subject is likely to change)
+-The Signing Certificates, which are used to verify the batch signature, CAN be self-signed. (this subject is likely to
+change)
-**SecReq-037** The Signing Certificates SHOULD set the Key Usage extension to "digitalSignature" (see [RFC 5280](https://tools.ietf.org/html/rfc5280#section-4.2.1.3)).
+**SecReq-037** The Signing Certificates SHOULD set the Key Usage extension to "digitalSignature" (
+see [RFC 5280](https://tools.ietf.org/html/rfc5280#section-4.2.1.3)).
--The Authentication Certificates, which are used to authenticate the National Backends, SHOULD set the Key Extended Usage extension to "clientAuth" (see [RFC 5280](https://tools.ietf.org/html/rfc5280#section-4.2.1.12)).
+-The Authentication Certificates, which are used to authenticate the National Backends, SHOULD set the Key Extended
+Usage extension to "clientAuth" (see [RFC 5280](https://tools.ietf.org/html/rfc5280#section-4.2.1.12)).
-###Cryptographic Requirements
+###Cryptographic Requirements
-**SecReq-042** The cryptographic operations performed with the National Backends certificates MUST fulfill the following requirements:
+**SecReq-042** The cryptographic operations performed with the National Backends certificates MUST fulfill the
+following requirements:
-| Signature Algorithm | Minimum Key Length | Hash Algorithm |
+| Signature Algorithm | Minimum Key Length | Hash Algorithm |
|---------------------|--------------------|----------------|
-| RSA | 2024 | SHA-256
SHA-384
SHA-512 |
-| ECDSA | 250 | SHA-256
SHA-384
SHA-512 |
-
-The above requirements were defined based on the [BSI recommendations](https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102.pdf?__blob=publicationFile&v=10) for cryptographic algorithms and key lengths.
+| RSA | 2024 | SHA-256
SHA-384
SHA-512 |
+| ECDSA | 250 | SHA-256
SHA-384
SHA-512 |
+The above requirements were defined based on
+the [BSI recommendations](https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102.pdf?__blob=publicationFile&v=10)
+for cryptographic algorithms and key lengths.
# Deployment View
-The system contains different stages which reflect the different perspectives
+
+The system contains different stages which reflect the different perspectives
to the deployed software.
Stages:
+
- DEV
- TEST
- ACC
- PROD
## Generic Deployment View
+
This view is a generic view which outlines the structure, but does not contain
any specifics related to a stage.
![Generic Deployment View](DGCG-deployment-template.png "Generic Deployment View")
+## General Software Versions and config
+Tomcat hosting service – tomcat instances that are controlled together. Deployment is performed using Nexus artefact
+repository. We confirmed in the meantime that the rolling upgrade is possible, but we still need to analyse the
+requirements against the service capabilities
-## General Software Versions and config
-
-Tomcat hosting service – tomcat instances that are controlled together. Deployment is performed using Nexus artefact repository. We confirmed in the meantime that the rolling upgrade is possible, but we still need to analyse the requirements against the service capabilities
- Tomcat version: Tomcat 9.0.37
- JDK version : JDK 11 (OpenJDK)
- Heap Size (MB): 8GB
@@ -442,59 +559,74 @@ Tomcat hosting service – tomcat instances that are controlled together. Deploy
- Direct Memory Size (MB): default (currently we are not able to specify this)
MySQL – Supported version: 5.7
+
- Required information to create the instance
- Character Set : utf8|latin1|utf16|utf32|other>: utf8
- Estimated DB Size: 10 GB
- Required capacity of the VM (GB of memory and number of vCPU) - 4 cores 16 GB RAM
- Number of concurrent users: 1 User for the application with max 28 sessions to store data
+## Stage DEV - Development
-## Stage DEV - Development
-As per beginning of the project a dev environment exists in the OTC allowing quick
+As per beginning of the project a dev environment exists in the OTC allowing quick
and easy access for developer.
Scaling Level
-- single worker node
+- single worker node
Security Level
+
- full security
Test Data
+
- has a number of countries preloaded
### Sizing TEST
+
Proposal
-- Worker Nodes 3x [4 x Cores, 16 GB RAM, 10 GB free Storage]
-- Database equivalent to 2x [4 Cores and 16 GB RAM]
+- Worker Nodes 3x [4 x Cores, 16 GB RAM, 10 GB free Storage]
+- Database equivalent to 2x [4 Cores and 16 GB RAM]
## Stage TEST
+
Scaling Level
+
- fully scaled
Security Level
+
- full security
Test Data
+
- has a number of countries preloaded
### Sizing TEST
+
Proposal
-- Worker Nodes 3x [4 x Cores, 16 GB RAM, 10 GB free Storage]
-- Database equivalent to 2x [4 Cores and 16 GB RAM]
+- Worker Nodes 3x [4 x Cores, 16 GB RAM, 10 GB free Storage]
+- Database equivalent to 2x [4 Cores and 16 GB RAM]
## Stage ACC
+
## Stage PROD
+
### Sizing PROD
Proposal
-- Worker Nodes 3x [4 x Cores, 16 GB RAM, 10 GB free Storage]
-- Database equivalent to 2x [4 Cores and 16 GB RAM]
+
+- Worker Nodes 3x [4 x Cores, 16 GB RAM, 10 GB free Storage]
+- Database equivalent to 2x [4 Cores and 16 GB RAM]
# Data Deletion
-The data base stores
+
+The data base stores
# Other Constraints and Conditions
-Timezone all times and dates are interpreted as timestamps in UTC (https://en.wikipedia.org/wiki/Coordinated_Universal_Time)
+
+Timezone all times and dates are interpreted as timestamps in
+UTC (https://en.wikipedia.org/wiki/Coordinated_Universal_Time)
diff --git a/manifests/deployment.yml b/manifests/deployment.yml
index d271fa40..0f9960cb 100644
--- a/manifests/deployment.yml
+++ b/manifests/deployment.yml
@@ -1,4 +1,4 @@
-apiVersion : apps/v1
+apiVersion: apps/v1
kind: Deployment
metadata:
name: "ddccservices-56e3"
@@ -16,4 +16,4 @@ spec:
- name: "ddccservices-56e3"
image: "ddccsrv.azurecr.io/ddccservices"
ports:
- - containerPort: 8080
\ No newline at end of file
+ - containerPort: 8080
\ No newline at end of file
diff --git a/manifests/service.yml b/manifests/service.yml
index c49e9723..812b44bb 100644
--- a/manifests/service.yml
+++ b/manifests/service.yml
@@ -1,15 +1,15 @@
apiVersion: v1
kind: Service
metadata:
- name: "ddccservices-56e3"
- labels:
- app: "ddccservices-56e3"
+ name: "ddccservices-56e3"
+ labels:
+ app: "ddccservices-56e3"
spec:
- type: LoadBalancer
- ports:
+ type: LoadBalancer
+ ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
- selector:
- app: "ddccservices-56e3"
\ No newline at end of file
+ selector:
+ app: "ddccservices-56e3"
\ No newline at end of file
diff --git a/owasp/suppressions.xml b/owasp/suppressions.xml
index 413e712f..5786d342 100644
--- a/owasp/suppressions.xml
+++ b/owasp/suppressions.xml
@@ -1,25 +1,25 @@
-
- Bug only affects not used features of embedded tomcat.
- CVE-2022-23181
-
-
- False Positive
- CVE-2016-1000027
-
-
- False Positive - Updated to newest version
- CVE-2018-14335
-
-
- False Positive
- CVE-2020-5408
-
-
- Only affecting example code shipped with tomcat.
- CVE-2022-34305
+
+ Bug only affects not used features of embedded tomcat.
+ CVE-2022-23181
+
+
+ False Positive
+ CVE-2016-1000027
+
+
+ False Positive - Updated to newest version
+ CVE-2018-14335
+
+
+ False Positive
+ CVE-2020-5408
+
+
+ Only affecting example code shipped with tomcat.
+ CVE-2022-34305
-
+
diff --git a/pom.xml b/pom.xml
index b190e16f..3c4a02b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.6.8
+ 2.7.3
@@ -43,23 +43,23 @@
UTF-8
UTF-8
- 7.1.1
- 5.7.2
+ 7.1.2
+ 5.7.3
1.18.24
- 4.13.0
- 1.6.9
+ 4.15.0
+ 1.6.11
1.5.2.Final
1.70
3.1.0
1.14.1
- 4.38.0
+ 4.41.0
2021.0.3
2.1.214
- 5.6.5.Final
+ 5.6.11.Final
1.3.1
- 3.4.1
- 3.1.2
+ 3.4.2
+ 3.2.0
3.9.1.2184
0.8.8
1.7.0
@@ -168,6 +168,17 @@
org.springframework.boot
spring-boot-starter
+
+
+ org.yaml
+ snakeyaml
+
+
+
+
+ org.yaml
+ snakeyaml
+ 1.31
org.springframework.boot
@@ -287,7 +298,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ 3.10.1
org.codehaus.mojo
@@ -297,12 +308,12 @@
org.apache.maven.plugins
maven-war-plugin
- 3.3.1
+ 3.3.2
org.apache.maven.plugins
maven-resources-plugin
- 3.2.0
+ 3.3.0
org.apache.maven.plugins
diff --git a/settings.xml b/settings.xml
index 9552ce4b..90474828 100644
--- a/settings.xml
+++ b/settings.xml
@@ -1,12 +1,12 @@
- false
-
-
- dgc-github
- ${app.packages.username}
- ${app.packages.password}
-
-
+ false
+
+
+ dgc-github
+ ${app.packages.username}
+ ${app.packages.password}
+
+
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/client/AssetManagerClient.java b/src/main/java/eu/europa/ec/dgc/gateway/client/AssetManagerClient.java
index 70be55bf..bd39a9b2 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/client/AssetManagerClient.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/client/AssetManagerClient.java
@@ -53,18 +53,18 @@ ResponseEntity uploadFile(@RequestHeader(HttpHeaders.AUTHORIZATION) String
@RequestBody byte[] file);
@PostMapping(
- value = "/ocs/v2.php/apps/files/api/v2/synchronize",
- consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
- produces = MediaType.APPLICATION_JSON_VALUE
+ value = "/ocs/v2.php/apps/files/api/v2/synchronize",
+ consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
+ produces = MediaType.APPLICATION_JSON_VALUE
)
ResponseEntity synchronize(
- @RequestHeader(HttpHeaders.AUTHORIZATION) String authHeader,
- @RequestHeader("OCS-APIRequest") String ocsApiRequest,
- @RequestBody SynchronizeFormData formData);
+ @RequestHeader(HttpHeaders.AUTHORIZATION) String authHeader,
+ @RequestHeader("OCS-APIRequest") String ocsApiRequest,
+ @RequestBody SynchronizeFormData formData);
@GetMapping(
- value = "/remote.php/dav/files/{uid}/{path}/{filename}",
- produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
+ value = "/remote.php/dav/files/{uid}/{path}/{filename}",
+ produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
ResponseEntity downloadFile(@RequestHeader(HttpHeaders.AUTHORIZATION) String authHeader,
@PathVariable("uid") String uid,
@PathVariable("path") String path,
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java
index bc2b909a..02577dbd 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java
@@ -33,7 +33,6 @@
import lombok.Setter;
-
@Getter
@Setter
@Entity
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java b/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java
index 12d6922d..62d57eb6 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java
@@ -66,10 +66,10 @@ List getByCertificateTypeAndCountryAndDeletedAtIsNull(
SignerInformationEntity.CertificateType type, String countryCode);
@Query(SELECT_SINCE)
- List getIsSince(@Param("since")ZonedDateTime since);
+ List getIsSince(@Param("since") ZonedDateTime since);
@Query(SELECT_SINCE)
- List getIsSince(@Param("since")ZonedDateTime since, Pageable pageable);
+ List getIsSince(@Param("since") ZonedDateTime since, Pageable pageable);
List getByDeletedAtIsNull();
@@ -77,13 +77,13 @@ List getByCertificateTypeAndCountryAndDeletedAtIsNull(
@Query(SELECT_BY_TYPE_SINCE)
List getByCertificateTypeIsSince(
- @Param("certType")SignerInformationEntity.CertificateType type,
- @Param("since")ZonedDateTime since);
+ @Param("certType") SignerInformationEntity.CertificateType type,
+ @Param("since") ZonedDateTime since);
@Query(SELECT_BY_TYPE_SINCE)
List getByCertificateTypeIsSince(
- @Param("certType")SignerInformationEntity.CertificateType type,
- @Param("since")ZonedDateTime since, Pageable pageable);
+ @Param("certType") SignerInformationEntity.CertificateType type,
+ @Param("since") ZonedDateTime since, Pageable pageable);
@Query(SELECT_BY_TYPE_AND_COUNTRY_SINCE)
List getByCertificateTypeAndCountryIsSince(
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/repository/TrustedPartyRepository.java b/src/main/java/eu/europa/ec/dgc/gateway/repository/TrustedPartyRepository.java
index 18e4f1c0..67bbcb8e 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/repository/TrustedPartyRepository.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/repository/TrustedPartyRepository.java
@@ -36,7 +36,7 @@ public interface TrustedPartyRepository extends JpaRepository= :since";
-
+
List getByCountryAndCertificateType(String country, TrustedPartyEntity.CertificateType type);
List getByCertificateType(TrustedPartyEntity.CertificateType type);
@@ -55,13 +55,13 @@ Optional getFirstByThumbprintAndCertificateType(
@Query(SELECT_BY_TYPE_SINCE)
List getByCertificateTypeIsSince(
- @Param("certType")TrustedPartyEntity.CertificateType type,
- @Param("since")ZonedDateTime since);
+ @Param("certType") TrustedPartyEntity.CertificateType type,
+ @Param("since") ZonedDateTime since);
@Query(SELECT_BY_TYPE_AND_COUNTRY_SINCE)
List getByCountryAndCertificateTypeIsSince(
- @Param("country")String countryCode,
- @Param("certType")TrustedPartyEntity.CertificateType type,
- @Param("since")ZonedDateTime since);
+ @Param("country") String countryCode,
+ @Param("certType") TrustedPartyEntity.CertificateType type,
+ @Param("since") ZonedDateTime since);
}
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateMigrationController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateMigrationController.java
index c89945a9..6589edf2 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateMigrationController.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateMigrationController.java
@@ -62,8 +62,8 @@ public class CertificateMigrationController {
public static final String SENT_VALUES_FORMAT = "{%s} country:{%s}";
public static final String X_004 = "0x004";
public static final String DEFAULT_ERROR_MESSAGE = "Possible reasons: Wrong Format,"
- + " no CMS, not the correct signing alg missing attributes, invalid signature, "
- + "certificate not signed by known CA";
+ + " no CMS, not the correct signing alg missing attributes, invalid signature, "
+ + "certificate not signed by known CA";
private final SignerInformationService signerInformationService;
@@ -81,24 +81,23 @@ public class CertificateMigrationController {
@GetMapping
@Operation(
security = {
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
},
summary = "Get all cms packages for a country identified by certificate.",
tags = {"CMS Migration"},
responses = {
- @ApiResponse(
- responseCode = "200",
- description = "Download successful.",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- schema = @Schema(implementation = CmsPackageDto.class)
- )
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "Download successful.",
+ content = @Content(
+ mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = CmsPackageDto.class)
+ ))
}
)
public ResponseEntity> getCmsPackages(
- @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String countryCode
+ @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String countryCode
) {
log.info("Getting cms packages for {}", countryCode);
@@ -119,51 +118,50 @@ public ResponseEntity> getCmsPackages(
/**
* Update a CMS Package.
- *
*/
@CertificateAuthenticationRequired
@PostMapping
@Operation(
- security = {
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
- },
- tags = {"CMS Migration"},
- summary = "Update an existing CMS Package",
- description = "Endpoint to update an existing CMS pacakage.",
- requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
- required = true,
- content = @Content(schema = @Schema(implementation = CmsPackageDto.class))
- ),
- responses = {
- @ApiResponse(
- responseCode = "204",
- description = "Update applied."),
- @ApiResponse(
- responseCode = "409",
- description = "CMS Package does not exist."),
- @ApiResponse(
- responseCode = "400",
- description = "Invalid CMS input.")
- }
+ security = {
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
+ },
+ tags = {"CMS Migration"},
+ summary = "Update an existing CMS Package",
+ description = "Endpoint to update an existing CMS pacakage.",
+ requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
+ required = true,
+ content = @Content(schema = @Schema(implementation = CmsPackageDto.class))
+ ),
+ responses = {
+ @ApiResponse(
+ responseCode = "204",
+ description = "Update applied."),
+ @ApiResponse(
+ responseCode = "409",
+ description = "CMS Package does not exist."),
+ @ApiResponse(
+ responseCode = "400",
+ description = "Invalid CMS input.")
+ }
)
public ResponseEntity updateCmsPackage(
- @RequestBody CmsPackageDto cmsPackageDto,
- @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String countryCode,
- @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_THUMBPRINT) String authThumbprint
+ @RequestBody CmsPackageDto cmsPackageDto,
+ @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String countryCode,
+ @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_THUMBPRINT) String authThumbprint
) {
if (CmsPackageDto.CmsPackageTypeDto.DSC == cmsPackageDto.getType()) {
SignedCertificateDto signedCertificateDto = getSignerCertificate(cmsPackageDto.getCms());
if (!signedCertificateDto.isVerified()) {
throw new DgcgResponseException(HttpStatus.BAD_REQUEST, "0x260", "CMS signature is invalid", "",
- "Submitted package needs to be signed by a valid upload certificate");
+ "Submitted package needs to be signed by a valid upload certificate");
}
try {
signerInformationService.updateSignerCertificate(cmsPackageDto.getEntityId(),
- signedCertificateDto.getPayloadCertificate(), signedCertificateDto.getSignerCertificate(),
- signedCertificateDto.getSignature(), countryCode);
+ signedCertificateDto.getPayloadCertificate(), signedCertificateDto.getSignerCertificate(),
+ signedCertificateDto.getSignature(), countryCode);
} catch (SignerInformationService.SignerCertCheckException e) {
handleSignerCertException(cmsPackageDto, countryCode, e);
}
@@ -172,17 +170,17 @@ public ResponseEntity updateCmsPackage(
if (!signedStringDto.isVerified()) {
throw new DgcgResponseException(HttpStatus.BAD_REQUEST, "0x260", "CMS signature is invalid", "",
- "Submitted package needs to be signed by a valid upload certificate");
+ "Submitted package needs to be signed by a valid upload certificate");
}
try {
if (CmsPackageDto.CmsPackageTypeDto.REVOCATION_LIST == cmsPackageDto.getType()) {
revocationListService.updateRevocationBatchCertificate(cmsPackageDto.getEntityId(),
- signedStringDto.getPayloadString(), signedStringDto.getSignerCertificate(),
- signedStringDto.getRawMessage(), countryCode);
+ signedStringDto.getPayloadString(), signedStringDto.getSignerCertificate(),
+ signedStringDto.getRawMessage(), countryCode);
} else if (CmsPackageDto.CmsPackageTypeDto.VALIDATION_RULE == cmsPackageDto.getType()) {
validationRuleService.updateValidationRuleCertificate(cmsPackageDto.getEntityId(),
- signedStringDto.getPayloadString(), signedStringDto.getSignerCertificate(),
- signedStringDto.getRawMessage(), countryCode);
+ signedStringDto.getPayloadString(), signedStringDto.getSignerCertificate(),
+ signedStringDto.getRawMessage(), countryCode);
}
} catch (RevocationListService.RevocationBatchServiceException e) {
handleRevocationBatchException(cmsPackageDto, countryCode, e);
@@ -207,14 +205,14 @@ private void handleSignerCertException(CmsPackageDto cmsPackageDto, String count
switch (e.getReason()) {
case EXIST_CHECK_FAILED:
throw new DgcgResponseException(HttpStatus.CONFLICT, "0x010",
- "Certificate to be updated does not exist.",
- sentValues, e.getMessage());
+ "Certificate to be updated does not exist.",
+ sentValues, e.getMessage());
case UPLOAD_FAILED:
throw new DgcgResponseException(HttpStatus.INTERNAL_SERVER_ERROR,
- "0x011", "Upload of new Signer Certificate failed", sentValues, e.getMessage());
+ "0x011", "Upload of new Signer Certificate failed", sentValues, e.getMessage());
default:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST, X_004, DEFAULT_ERROR_MESSAGE, sentValues,
- e.getMessage());
+ e.getMessage());
}
}
@@ -225,17 +223,17 @@ private void handleRevocationBatchException(CmsPackageDto cmsPackageDto, String
switch (e.getReason()) {
case NOT_FOUND:
throw new DgcgResponseException(HttpStatus.CONFLICT, "0x020",
- "RevocationBatch to be updated does not exist.",
- sentValues, e.getMessage());
+ "RevocationBatch to be updated does not exist.",
+ sentValues, e.getMessage());
case INVALID_COUNTRY:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST,
- "0x021", "Invalid country", sentValues, e.getMessage());
+ "0x021", "Invalid country", sentValues, e.getMessage());
case INVALID_JSON_VALUES:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST,
- "0x022", "Json Payload invalid", sentValues, e.getMessage());
+ "0x022", "Json Payload invalid", sentValues, e.getMessage());
default:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST, X_004, DEFAULT_ERROR_MESSAGE, sentValues,
- e.getMessage());
+ e.getMessage());
}
}
@@ -246,17 +244,17 @@ private void handleValidationRuleExcepetion(CmsPackageDto cmsPackageDto, String
switch (e.getReason()) {
case NOT_FOUND:
throw new DgcgResponseException(HttpStatus.CONFLICT, "0x030",
- "ValidationRule to be updated does not exist.",
- sentValues, e.getMessage());
+ "ValidationRule to be updated does not exist.",
+ sentValues, e.getMessage());
case INVALID_COUNTRY:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST,
- "0x031", "Invalid country", sentValues, e.getMessage());
+ "0x031", "Invalid country", sentValues, e.getMessage());
case INVALID_JSON:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST, "0x032", "Json Payload invalid", sentValues,
- e.getMessage());
+ e.getMessage());
default:
throw new DgcgResponseException(HttpStatus.BAD_REQUEST, X_004, DEFAULT_ERROR_MESSAGE, sentValues,
- e.getMessage());
+ e.getMessage());
}
}
}
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java
index d0b5cdd5..3718c06b 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java
@@ -76,7 +76,7 @@ public class CertificateRevocationListController {
private final RevocationBatchMapper revocationBatchMapper;
public static final String UUID_REGEX =
- "^[0-9a-f]{8}\\b-[0-9a-f]{4}\\b-[0-9a-f]{4}\\b-[0-9a-f]{4}\\b-[0-9a-f]{12}$";
+ "^[0-9a-f]{8}\\b-[0-9a-f]{4}\\b-[0-9a-f]{4}\\b-[0-9a-f]{4}\\b-[0-9a-f]{12}$";
private static final String MDC_DOWNLOADER_COUNTRY = "downloaderCountry";
private static final String MDC_DOWNLOADED_COUNTRY = "downloadedCountry";
@@ -88,19 +88,19 @@ public class CertificateRevocationListController {
@CertificateAuthenticationRequired(requiredRoles = CertificateAuthenticationRole.RevocationListReader)
@GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(
- security = {
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
- },
- tags = {"Revocation"},
- summary = "Download Batch List",
- description = "Returning a list of batches with a small wrapper providing metadata."
- + " The batches are sorted by date in ascending (chronological) order.",
- parameters = {
- @Parameter(
- in = ParameterIn.HEADER,
- name = HttpHeaders.IF_MODIFIED_SINCE,
- description = "This header contains the last downloaded date to get just the latest results. "
+ security = {
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
+ },
+ tags = {"Revocation"},
+ summary = "Download Batch List",
+ description = "Returning a list of batches with a small wrapper providing metadata."
+ + " The batches are sorted by date in ascending (chronological) order.",
+ parameters = {
+ @Parameter(
+ in = ParameterIn.HEADER,
+ name = HttpHeaders.IF_MODIFIED_SINCE,
+ description = "This header contains the last downloaded date to get just the latest results. "
+ "On the initial call the header should be the set to ‘2021-06-01T00:00:00Z’",
required = true)
},
@@ -155,22 +155,22 @@ public ResponseEntity downloadBatchList(
required = true)
},
responses = {
- @ApiResponse(
- responseCode = "200",
- description = "Response contains the batch.",
- content = @Content(schema = @Schema(implementation = RevocationBatchDto.class)),
- headers = @Header(name = HttpHeaders.ETAG, description = "Batch ID")),
- @ApiResponse(
- responseCode = "404",
- description = "Batch does not exist."),
- @ApiResponse(
- responseCode = "410",
- description = "Batch already deleted.")
+ @ApiResponse(
+ responseCode = "200",
+ description = "Response contains the batch.",
+ content = @Content(schema = @Schema(implementation = RevocationBatchDto.class)),
+ headers = @Header(name = HttpHeaders.ETAG, description = "Batch ID")),
+ @ApiResponse(
+ responseCode = "404",
+ description = "Batch does not exist."),
+ @ApiResponse(
+ responseCode = "410",
+ description = "Batch already deleted.")
}
)
public ResponseEntity downloadBatch(
- @Valid @PathVariable("batchId") @Pattern(regexp = UUID_REGEX) String batchId,
- @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String downloaderCountry) {
+ @Valid @PathVariable("batchId") @Pattern(regexp = UUID_REGEX) String batchId,
+ @RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String downloaderCountry) {
try {
RevocationBatchDownload download = revocationListService.getRevocationBatch(batchId);
@@ -183,9 +183,9 @@ public ResponseEntity downloadBatch(
log.info("Revocation Batch downloaded.");
return ResponseEntity
- .ok()
- .header(HttpHeaders.ETAG, download.getBatchId())
- .body(download.getSignedCms());
+ .ok()
+ .header(HttpHeaders.ETAG, download.getBatchId())
+ .body(download.getSignedCms());
} catch (RevocationListService.RevocationBatchServiceException e) {
switch (e.getReason()) {
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java
index d0c284d3..4da39412 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java
@@ -148,12 +148,12 @@ public ResponseEntity> downloadTrustList(
@RequestAttribute(CertificateAuthenticationFilter.REQUEST_PROP_COUNTRY) String downloaderCountryCode
) {
List trustList;
- if (isPaginationRequired(page,size)) {
+ if (isPaginationRequired(page, size)) {
page = (page != null && page >= 0) ? page : 0;
size = (size != null && size >= 0) ? size : 100;
trustList = trustListMapper.trustListToTrustListDto(
- trustListService.getTrustList(ifModifiedSince, page, size));
+ trustListService.getTrustList(ifModifiedSince, page, size));
} else {
trustList = trustListMapper.trustListToTrustListDto(
trustListService.getTrustList(ifModifiedSince, null, null));
@@ -242,12 +242,12 @@ public ResponseEntity> downloadTrustListFilteredByType(
TrustListType mappedType = trustListMapper.certificateTypeDtoToTrustListType(type);
List trustList;
- if (isPaginationRequired(page,size)) {
+ if (isPaginationRequired(page, size)) {
page = (page != null && page >= 0) ? page : 0;
size = (size != null && size >= 0) ? size : 100;
trustList = trustListMapper.trustListToTrustListDto(
- trustListService.getTrustList(mappedType, ifModifiedSince, page, size));
+ trustListService.getTrustList(mappedType, ifModifiedSince, page, size));
} else {
trustList = trustListMapper.trustListToTrustListDto(
trustListService.getTrustList(mappedType, ifModifiedSince, null, null));
@@ -347,12 +347,12 @@ public ResponseEntity> downloadTrustListFilteredByCountryAndT
countryCode = countryCode.toUpperCase(Locale.ROOT);
List trustList;
- if (isPaginationRequired(page,size)) {
+ if (isPaginationRequired(page, size)) {
page = (page != null && page >= 0) ? page : 0;
size = (size != null && size >= 0) ? size : 100;
trustList = trustListMapper.trustListToTrustListDto(
- trustListService.getTrustList(mappedType, countryCode, ifModifiedSince, page, size));
+ trustListService.getTrustList(mappedType, countryCode, ifModifiedSince, page, size));
} else {
trustList = trustListMapper.trustListToTrustListDto(
trustListService.getTrustList(mappedType, countryCode, ifModifiedSince, null, null));
@@ -373,47 +373,46 @@ public ResponseEntity> downloadTrustListFilteredByCountryAndT
@CertificateAuthenticationRequired
@GetMapping(path = "/issuers", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(
- security = {
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
- @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
- },
- summary = "Returns the list of trusted issuers filtered by criterias.",
- tags = {"Trust List"},
- parameters = {
- @Parameter(
- in = ParameterIn.QUERY,
- name = "country",
- description = "Two-Digit Country Code",
- examples = {@ExampleObject("EU"), @ExampleObject("DE")}
- )
- },
- responses = {
- @ApiResponse(
- responseCode = "200",
- description = "Returns the list of trusted issuers.",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- array = @ArraySchema(schema = @Schema(implementation = TrustedIssuerDto.class)))),
- @ApiResponse(
- responseCode = "401",
- description = "Unauthorized. No Access to the system."
- + "(Client Certificate not present or whitelisted)",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- schema = @Schema(implementation = ProblemReportDto.class)
- ))
- })
+ security = {
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_HASH),
+ @SecurityRequirement(name = OpenApiConfig.SECURITY_SCHEMA_DISTINGUISH_NAME)
+ },
+ summary = "Returns the list of trusted issuers filtered by criterias.",
+ tags = {"Trust List"},
+ parameters = {
+ @Parameter(
+ in = ParameterIn.QUERY,
+ name = "country",
+ description = "Two-Digit Country Code",
+ examples = {@ExampleObject("EU"), @ExampleObject("DE")})
+ },
+ responses = {
+ @ApiResponse(
+ responseCode = "200",
+ description = "Returns the list of trusted issuers.",
+ content = @Content(
+ mediaType = MediaType.APPLICATION_JSON_VALUE,
+ array = @ArraySchema(schema = @Schema(implementation = TrustedIssuerDto.class)))),
+ @ApiResponse(
+ responseCode = "401",
+ description = "Unauthorized. No Access to the system."
+ + "(Client Certificate not present or whitelisted)",
+ content = @Content(
+ mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = ProblemReportDto.class)
+ ))
+ })
public ResponseEntity> getTrustedIssuersByCountry(
- @RequestParam(value = "country", required = false) List<@Size(min = 2, max = 2) String> searchCountry
+ @RequestParam(value = "country", required = false) List<@Size(min = 2, max = 2) String> searchCountry
) {
if (CollectionUtils.isNotEmpty(searchCountry)) {
log.debug("Downloading TrustedIssuers TrustList. Parameters country: {}", searchCountry);
return ResponseEntity.ok(trustedIssuerMapper.trustedIssuerEntityToTrustedIssuerDto(
- trustedIssuerService.getAllIssuers(searchCountry)));
+ trustedIssuerService.getAllIssuers(searchCountry)));
} else {
log.debug("Downloading all TrustedIssuers TrustList.");
return ResponseEntity.ok(trustedIssuerMapper.trustedIssuerEntityToTrustedIssuerDto(
- trustedIssuerService.getAllIssuers()));
+ trustedIssuerService.getAllIssuers()));
}
}
diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java
index 7db4db45..220eba22 100644
--- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java
+++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java
@@ -104,8 +104,7 @@ public class ValidationRuleController {
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(ref = "#/components/schemas/ValidationRuleDownloadResponse")
- )
- )
+ ))
}
)
public ResponseEntity