Aligned with version 1.00 / 2021-4-14 of the spec: https://github.com/ehn-digital-green-development/hcert-spec/blob/main/hcert_spec.md
For round-trip testing of cose_sign.py
and cose_verify.py
take some
JSON, e.g. { "Foo" : "Bar }
, CBOR package, COSE sign, compress and base45
convert it for use in a QR.
- COSE sign
- compact the JSOn into CBOR
- sign and package as a COSE message
- ZLIB compress
- Base45 encode
- COSE verify
- Base45 decode
- ZLIB decompress
- check the signature on the COSE message
- unpack the CBOR into JSON
- Generate the CSCA and DSC with
./gen-csca-dsc.sh
- Run the command:
echo "{'A': 1234}" | python3.8 cose_sign.py | python3.8 cose_verify.py
- You should see the output:
{"A": 1234}
echo '{ "Foo":1, "Bar":{ "Field1": "a value", "integer":1212112121 }}' | python3.8 cose_sign.py | python3.8 cose_verify.py prettyprint-json
Which should output:
{
"Foo": 1,
"Bar": {
"Field1": "a value",
"integer": 1212112121
}
}
Testing against the AT cases:
-
Fetch the Base64 from https://dev.a-sit.at/certservice
-
Remove the first 2 bytes and do
pbpaste| sed -e 's/^00//' | python3.8 cose_verify.py --base64 --ignore-signature --cbor