This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from admin-ch/feature/keys-list-up-to
Feature/keys list up to
- Loading branch information
Showing
20 changed files
with
916 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...data/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/data/util/TestUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2021 Ubique Innovation AG <https://www.ubique.ch> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
package ch.admin.bag.covidcertificate.backend.verifier.data.util; | ||
|
||
import ch.admin.bag.covidcertificate.backend.verifier.model.cert.Algorithm; | ||
import ch.admin.bag.covidcertificate.backend.verifier.model.cert.db.DbCsca; | ||
import ch.admin.bag.covidcertificate.backend.verifier.model.cert.db.DbDsc; | ||
|
||
public class TestUtil { | ||
|
||
private TestUtil() {} | ||
|
||
public static DbCsca getDefaultCsca(int idSuffix, String origin) { | ||
var dbCsca = new DbCsca(); | ||
dbCsca.setKeyId("keyid_" + idSuffix); | ||
dbCsca.setCertificateRaw("cert"); | ||
dbCsca.setOrigin(origin); | ||
dbCsca.setSubjectPrincipalName("admin_ch"); | ||
return dbCsca; | ||
} | ||
|
||
public static DbDsc getRsaDsc(int idSuffix, String origin, long fkCsca) { | ||
final var dbDsc = new DbDsc(); | ||
dbDsc.setKeyId("keyid_" + idSuffix); | ||
dbDsc.setFkCsca(fkCsca); | ||
dbDsc.setCertificateRaw("cert"); | ||
dbDsc.setOrigin(origin); | ||
dbDsc.setUse("sig"); | ||
dbDsc.setAlg(Algorithm.RS256); | ||
dbDsc.setN("n"); | ||
dbDsc.setE("e"); | ||
dbDsc.setSubjectPublicKeyInfo("pk"); | ||
return dbDsc; | ||
} | ||
|
||
public static DbDsc getEcDsc(int idSuffix, String origin, long fkCsca) { | ||
final var dbDsc = new DbDsc(); | ||
dbDsc.setKeyId("keyid_" + idSuffix); | ||
dbDsc.setFkCsca(fkCsca); | ||
dbDsc.setCertificateRaw("cert"); | ||
dbDsc.setOrigin(origin); | ||
dbDsc.setUse("sig"); | ||
dbDsc.setAlg(Algorithm.ES256); | ||
dbDsc.setCrv("crv"); | ||
dbDsc.setX("x"); | ||
dbDsc.setY("y"); | ||
return dbDsc; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.