Skip to content

pyca/cryptography backwards incompatible since 35.0.0 / faulty country data? #21

@jsuesse

Description

@jsuesse

Disclaimer:
I think this is lowest priority / documentation.
I did not modify any script-related file when this appeared.
Using no further parameters I was able to verify my German QR-code before.
./verify_ehc.py --image qr.jpeg

First appearance

I was playing around with --certs-from and --save-certs using different combination of countries, separately choosing json or cbor.
I ran ./verify_ehc.py --certs-from AT,DE,SE,NL --save-certs trust_list.json successful.
I got errors running ./verify_ehc.py --certs-from AT,DE,SE --save-certs trust_list.json (no NL).
Error:

Traceback (most recent call last):
  File "./verify_ehc.py", line 2435, in <module>
    main()
File "./verify_ehc.py", line 2373, in main
    save_certs(certs, certs_path, args.allow_public_key_only)
  File "./verify_ehc.py", line 1879, in save_certs
    'usage': sorted(get_key_usage(cert)),
  File "./verify_ehc.py", line 2022, in get_key_usage
    ext_key_usage = cert.extensions.get_extension_for_oid(ExtensionOID.EXTENDED_KEY_USAGE)
ValueError: error parsing asn1 value: ParseError { kind: EncodedDefault, location: ["BasicConstraints::ca"] } 

Investigation

Downloading JSON from all countries

I ran ./verify_ehc.py --certs-from XX --save-certs trust_list.json
with X being all countries one by one. (AT DE SE NL GB CH FR NO)

Failed with "No Token" (This is expected, see Readme)

CH FR NO

Failed with Type Error

DE, SE, AT
no json file was created

Successful

GB NL

I then tried verifying my qr-code with these trust_lists.
trust_GB:

KeyError: 'Key ID not found in trust list

ok - expected.

trust_NL:

 TypeError: can't compare offset-naive and offset-aware datetimes

that's weird! something for another time, moving on...

Downloading CBOR from all countries

I was wondering why ./verify_ehc.py --image qr.jpeg still worked.
Upon reading the README.md once again I realized JSON could be at fault.
I then did the same as before, collecting certs for all countries one by one but using cbor.

Successful

DE SE AT

faulty (expected)

NL GB
got a bunch of these or similiar looking.
ERROR: Cannot store entry 840d7ea7010ec422 / hA1+pwEOxCI= in CBOR trust list: cannot serialize certificate from public-key only
these countries provided JSON already. see README.md

no token (expected)

FR CH NO

Conclusion

might not be correct

DE, SE, AT provide CBOR
NL GB provide JSON
CH FR NO need token. I didn't bother to get them.

In my humble opinion this was not clearly stated in README.
Proposal: Include which countries provide which format in README.

Could you please have a look?
Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions