f-pisani / france-ehealth-certificates

This library provides a quick and easy interface to verify COVID-19 certificates generated in France.
MIT License
1 stars 2 forks source link

How its works ? #2

Closed lillois59 closed 2 years ago

lillois59 commented 2 years ago

Hi @f-pisani great work, I playing around some program in order to recompile my own green digital pass (FR) so now after several tests I can now read and decode my qr using vynvle.org but my signature appear still outdated or Invalide, in some android app lile Wallets or Spanish app my Qr code work also but still Invalide because my signature in COSE CBOR are not regognise using -45 string. I used many tools to sign like minisign but I fail maybe using your project I, we can fix this missconfiguration please @f-pisani ?

_/Users/Apple/france-ehealth-certificates/tests/integration/Sanitary.test.ts:5 describe('Sanitary certificate', () => { ^ ReferenceError: describe is not defined at Object. (/Users/Apple/france-ehealth-certificates/tests/integration/Sanitary.test.ts:5:1) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1371:23) at Module._extensions..js (node:internal/modules/cjs/loader:1149:10) at Object.require.extensions. [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1374:12) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at main (/usr/local/lib/node_modules/ts-node/src/bin.ts:331:12) at Object. (/usr/local/lib/node_modules/ts-node/src/bin.ts:482:3)_

**

f-pisani commented 2 years ago

Hi, I've just tested it out, it still works. If you cloned the repository, make sure to run npm install and npm run test to launch tests, if it still failed can you provide me the command you're trying to run ?

But you don't need to download the repository to use it inside your project simply use npm install france-ehealth-certificates inside your project and then follow the example as shown https://github.com/f-pisani/france-ehealth-certificates#vaccination-certificates.

Important: This library was designed for the first version of the French digital pass, France use European eHealth format since mid July. Check https://github.com/ehn-dcc-development for more informations.

lillois59 commented 2 years ago

thanks you to reply @f-pisani,

its working well, my question is how I can verify or Sign eHealth cert using your library ? I'm working on compile green pass using theses links : https://ehealth.vyncke.org/ https://github.com/ehn-dcc-development/hcert-spec/blob/main/hcert_spec.md https://ec.europa.eu/health/sites/default/files/ehealth/docs/covid-certificate_json_specification_en.pdf

**Apple$ npm run test

france-ehealth-certificates@1.0.4 test mocha -r ts-node/register tests/*/.ts

Sanitary certificate ✔ Sanitary constructor should throws error with malformed data ✔ Verify signature for valid certificate should return true (606ms) ✔ Verify signature with corrupted data should return false (332ms) ✔ Verify signature should throws error with malformed public key ✔ Try verify signature should not throws with malformed public key ✔ Sanitary certificate should parse fields

Vaccination certificate ✔ Vaccination constructor should throws error with malformed data ✔ Verify signature for valid certificate should return true (197ms) ✔ Verify signature with corrupted data should return false (200ms) ✔ Verify signature should throws error with malformed public key ✔ Try verify signature should not throws with malformed public key ✔ Vaccination certificate should parse fields

12 passing (1s)**

Can you help me to fix Cose Cbor signature please ?

f-pisani commented 2 years ago

I updated the README to avoid further confusion. Unfortunatly, this library was meant to be used with french 2D-DOC certificates (https://ants.gouv.fr/nos-missions/les-solutions-numeriques/2d-doc). Since France use the European eHealth certificate and not the 2D-DOC anymore, this library is not what your looking for.

Try to look https://github.com/ehn-dcc-development/ehn-sign-verify-javascript-trivial for example on how to validate European eHealth certificates using javascript.

lillois59 commented 2 years ago

thanks again for your support @f-pisani and advice, I used this one better for me https://github.com/ehn-dcc-development/ehn-sign-verify-python-trivial I got this result bellow* : (we can see dumpy HC1:DATA) check here https://covid-pass.pages.dev/

My question is and I think We can, how we can sign my qr code I mean I have my own playing around some program decode/encode I got my personal data (all include URN:UVCI:V1:FR:BLABLABLA) but when I sign in my qrcode are not more valide only working in some android app like Wallet app and their web site (app.getcovidpass.eu) or SpTH, passchecker. Not working in TousAnticovid (FR) because I think the algo signature are not regognise (Error: Ce certificat n'a pas été signé par une entité reconnue. kid: AA==') from sanipass.fr

tools used to generate qrcode : https://github.com/rascafr/eu-covid-qr-parser-demo/blob/master/index.js from @rascafr https://python-cwt.readthedocs.io/en/stable/algorithms.html#cose-key-types https://github.com/ehn-dcc-development/ehn-sign-verify-python-trivial https://packagegalaxy.com/javascript/france-ehealth-certificaces https://ehealth.vyncke.org/ sanipasse.fr/

Please help @f-pisani cause -bash: qrdecode: command not found I can't add my file.png .jpg ....

MBP:ehn-sign-verify-python-trivial Apple$ echo '{ "foo": "bar" }' | python3 hc1_sign.py HC1:NCFC80430FFWTWGSLKC 4/79WYKIH9$8789E6B0XK3JCQGA4F3Z8NQ3T3F36PPW4TY50.FK5IKX.CU3EUJCMKET58VLDC880KG$%6*SA2MI:CD+6N.J7QWAF4LLJ1L1LV9CY5HG+I. SNIMMYO:5RKMEM25XQ4CTS:Y1IHEPQNH 8ZOO8ZDHX6%R0Q5VV0**