tibordp / eudcc-validator Goto Github PK
View Code? Open in Web Editor NEWValidator app for EU Digital Covid Certificates
Home Page: https://eudcc.ojdip.net
License: MIT License
Validator app for EU Digital Covid Certificates
Home Page: https://eudcc.ojdip.net
License: MIT License
I tested your validator with my personal certificate and got the error that "The DCC is not in a supported format, so the validity cannot be verified." This issue comes from the fact that your code assumes the kid
is located in the protected part of the WebToken. In my case the kid
is located in the unprotected part.
The spec says: "The Key Identifier is not a security-critical field. For this reason, it MAY also be placed in an unprotected header if required. Verifiers MUST accept both options. If both options are present, the Key Identifier in the protected header MUST be used."
A simple change to make it work would be:
diff --git a/src/decode.js b/src/decode.js
index 534ce57..512fdc8 100644
--- a/src/decode.js
+++ b/src/decode.js
@@ -59,9 +59,11 @@ export const decodeEudcc = async (data, trustList) => {
// Try to extract KID from the certificate, if it is not present,
// we will not be able to validate the signature, but we can still
// display the data. We only target version 1.3.0+ of the spec.
- const signatureInfo = cbor.decodeFirstSync(decoded.value[0]);
+ const signatureInfo_protected = cbor.decodeFirstSync(decoded.value[0]);
+ const signatureInfo_unprotected = decoded.value[1];
kid = Buffer.from(
- signatureInfo.get(cose.common.HeaderParameters.kid)
+ signatureInfo_protected.get(cose.common.HeaderParameters.kid) ||
+ signatureInfo_unprotected.get(cose.common.HeaderParameters.kid)
).toString("base64");
} catch (e) {
return { data: hcert, error: "UNSUPPORTED_FORMAT" };
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.