rfc3161ng icon indicating copy to clipboard operation
rfc3161ng copied to clipboard

Library throws exception using the default parameter for certificate

Open elbosso opened this issue 3 years ago • 1 comments

When falling back to the vertificate inside the reply for verification like so:

import rfc3161ng
rt = rfc3161ng.RemoteTimestamper('http://time.certum.pl', include_tsa_certificate=True)
tst = rt.timestamp(data=b'John Doe')
rt.check(tst, data=b'John Doe')

an exception is thrown because the code can not handle parameter certificate in load_certificate being None:

Traceback (most recent call last):
  File "rfc.py", line 4, in <module>
    rt.check(tst, data=b'John Doe')
  File "venv/lib/python3.6/site-packages/rfc3161ng/api.py", line 229, in check
    hashname=self.hashname,
  File "venv/lib/python3.6/site-packages/rfc3161ng/api.py", line 142, in check_timestamp
    certificate = load_certificate(signed_data, certificate)
  File "venv/lib/python3.6/site-packages/rfc3161ng/api.py", line 123, in load_certificate
    if b'-----BEGIN CERTIFICATE-----' in certificate:
TypeError: argument of type 'NoneType' is not iterable

elbosso avatar Apr 09 '21 16:04 elbosso