Closed thinkberg closed 3 years ago
We have one available: https://github.pathcheck.org/eu.dgc.html
If you paste your PubKey Certificate on the EU HC1 Credentials and then the HC1 code on the Verify QR box. Hit Verify and the website will unpack the HC1, cryptographically verify and return the original JSON you signed.
You can also sign QRs on the same screen and use them to verify your code.
Hope that helps.
I made a debug screen just for you: https://github.pathcheck.org/debug.html
Since we don't have a key resolver yet, make sure to change the public key to keys you are using.
:)
You don't have the CWT in your payload?
The CWT is removed by COSE when you call the verify. It returns the original JSON file used to sign.
Then I have a massive misunderstanding. Your Base45 does not contain a CWT structure as far as I can see. From what I understand we have structure like this:
COSE(header={kid:...}, payload=CWT(DGC)))
which translates to something like this when unpacking:
(example taken from a colleague on the LF Slack, mine look the same): {"1":"BG","4":1651438800,"6":1619902800,"-260":{"v":[{"ci":"urn:uvci:10:BG:3P3K6F5GLW46LRZT#H","co":"BG","dn":1,"dt":"2021-02-16","is":"Ministry of Health","ma":"ORG-100030215","mp":"EU/1/20/1528","sd":2,"tg":"840539006","vp":"J07BX03"},{"ci":"urn:uvci:10:BG:3P3K6F5GLW46LRZT#H","co":"BG","dn":2,"dt":"2021-03-09","is":"Ministry of Health","ma":"ORG-100030215","mp":"EU/1/20/1528","sd":2,"tg":"840539006","vp":"J07BX03"}],"dob":"1978-01-26","nam":{"fn":"\u041f\u0415\u0422\u041a\u041e\u0412","gn":"\u0421\u0422\u0410\u041c\u041e \u0413\u0415\u041e\u0420\u0413\u0418\u0415\u0412","fnt":"PETKOV","gnt":"STAMO<GEORGIEV"},"ver":"1.0.0"}}
Which matches the examples here: https://dgc.a-sit.at/ehn/testsuite
Hum... good catch. Maybe I am based on an older version.
Do you know what is public key they are using? I need access to that Certificate to understand this better.
@vitorpamplona (and also @thinkberg since we discussed this on slack today) the implementation is based on this code here: https://github.com/ehn-digital-green-development/hcert-service-kotlin there is a readme on how to get the public key, the service implements the national trustlist but also the call to get the cert for a given KID
I think I am just confused with this CWT thing. For instance, the mobile app's verifier does not have CWT as well. In fact, it doesn't even call the function: https://github.com/ehn-digital-green-development/dgc-check-mobile-app/blob/main/src/app/services/cose-verifier.service.ts
Ok, I am finding that the https://dgc.a-sit.at/ehn/testsuite adds TWO CWTs, one by COSE itself and another one manually added as payload=CWT(DGC).
Why do we have two? Maybe this is a library thing.
I think that is correct, see https://tools.ietf.org/html/rfc8392 page 20:
18(
[
/ protected / << {
/ alg / 1: -7 / ECDSA 256 /
} >>,
/ unprotected / {
/ kid / 4: h'4173796d6d657472696345434453413
23536' / 'AsymmetricECDSA256' /
},
/ payload / << {
/ iss / 1: "coap://as.example.com",
/ sub / 2: "erikw",
/ aud / 3: "coap://light.example.com",
/ exp / 4: 1444064944,
/ nbf / 5: 1443944944,
/ iat / 6: 1443944944,
/ cti / 7: h'0b71'
} >>,
/ signature / h'5427c1ff28d23fbad1f29c4c7c6a555e601d6fa29f
9179bc3d7438bacaca5acd08c8d4d4f96131680c42
9a01f85951ecee743a52b9b63632c57209120e1c9e
30'
]
)
Figure 11: Signed CWT in CBOR Diagnostic Notation
Nice, yes. Thank you!
I just fixed it. Now we are generating with the CWT as well.
You can also now copy the HC1 code from the AT page, use this key:
-----BEGIN CERTIFICATE-----
MIIBIzCByqADAgECAgRi5XwLMAoGCCqGSM49BAMCMBAxDjAMBgNVBAMMBUVDLU1l
MB4XDTIxMDQyMzEwMzc1NVoXDTIxMDUyMzEwMzc1NVowEDEOMAwGA1UEAwwFRUMt
TWUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT4pyqh0AMFtrN/rLF4tKBB+Rhp
6ttuC6JTQ4c4fIy9f6H/Hjko8v6fYWkz3WrhKV7e0ScI4RLbT6nrv/F/6sJQoxIw
EDAOBgNVHQ8BAf8EBAMCBaAwCgYIKoZIzj0EAwIDSAAwRQIhAMQjFFnmgFx1scLH
6+iY9Vyu3EYkHEzNXUv7Zr/H6gJDAiAw7Sry/U7h/X+Hk1MncAqln7dpK2MDKABc
46ByFwZ+Bw==
-----END CERTIFICATE-----
And the package will verify.
Does anyone have an online version where I can drop Base45 to check whether the CWT is correct and the DGC matches the schema?