Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library throws exception using the default parameter for certificate #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

elbosso
Copy link

@elbosso elbosso commented Apr 9, 2021

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

@trbs
Copy link
Owner

trbs commented Jun 4, 2021

Could you please redo the commits and remove all other changes not relevant to the issue ?

Also it would be really helpful to have a small test case that triggers this error so we can be sure that we fixed the issue and that we do not regress later.

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants