ehn-dcc-development / ehn-sign-verify-python-trivial

Extremely minimal python implementation of the eHN-S protocol.
European Union Public License 1.2
76 stars 41 forks source link

echo "{'A': 1234}" | python3 hc1_sign.py | python3 hc1_verify.py #16

Open barmosseri opened 2 years ago

barmosseri commented 2 years ago
Traceback (most recent call last):
  File "/root/Desktop/ehn-sign-verify-python-trivial/hc1_sign.py", line 85, in <module>
    payload = json.loads(payload.decode("utf-8"))
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
Traceback (most recent call last):
  File "/root/Desktop/ehn-sign-verify-python-trivial/hc1_verify.py", line 153, in <module>
    if (cin[0] == 0x78):
IndexError: index out of range

Any idea whats wrong?

dirkx commented 2 years ago

It may be a python version/lib thing - but more likely is something in the payload you are sending into hc1_sign.py.

Try with something as simple as:

    echo '{ "foo": "bar" }' | ./hc1_sign.py 

or pipe your JSON through 'jq' or a json linter.

Isacco00 commented 2 years ago

i have the same error

lillois59 commented 2 years ago

@dirkx @barmosseri @Isacco00 try this cmd

    echo '{ "foo": "bar" }' | python3 hc1_sign.py
okainov commented 2 years ago

@dirkx can you please either fix the readme or merge one of pending PRs which fix this issue? See #24 for example as the most recent one, also #3 was fixing this as well.

dirkx commented 2 years ago

Done and apologies for the tardiness!