ehn-dcc-development / eu-dcc-hcert-spec

Electronic Health Certificates Specification
363 stars 40 forks source link

clarify header priority for KID #52

Closed HorayNarea closed 3 years ago

HorayNarea commented 3 years ago

In https://github.com/ehn-digital-green-development/hcert-spec/blob/main/hcert_spec.md#333-key-identifier you describe that the KID may be present in both, the protected and the unprotected header and that Verifiers MUST accept both options.

I would suggest to add If both options are present, the Key Identifier in the protected header MUST be used., to prevent confusion and unwanted differences between implementations.

kernoelpanic commented 3 years ago

I have also a question related to this aspect of the KID: Isn't the spec generally missing the requirement that the KID has to match a DSC of the issuing country of the HCERT? If just the "Secretariat" is queried for a valid KIDs than there needs to be a check somewhere if the right KID for the right country was fetched. Otherwise countries might be able to issue certificates for other countries outside their jurisdiction.

This though came across my mind from this sentence suggesting that DSC and KID does not have to verified:

Note that Verifiers do not need to calculate the kid based on the DSC certificate and can directly match the key identifier in issued health certificate with the kid on the trusted list.

jschlyter commented 3 years ago

@HorayNarea your suggestion looks good. @dirkx?

jschlyter commented 3 years ago

@kernoelpanic the signature will not validate correctly unless there is also a matching key pair. Countries may try to issue HCERTs with the wrong kid, but they will of course not validate.

Verifiers validates the signature will all known keys, finding subset to use for validation based on the kid. That subset is normally a single key, but in theory it could be many. If the signature is verified by a key, the issuer can be found on the trusted list. In the unlikely event that there's a collision with multiple kids, verifiers must also check the public key material before presenting the issuer.

dirkx commented 3 years ago

Should be addressed.