Hello here!
I have trouble using ACME python lib and to renew a certificate without enrolling another time an account…
I base my code on https://github.com/certbot/certbot/blob/master/acme/examples/http01_example.py
The first time I issue a certificate, no problem:
- create and save the account key
- enroll account with
.new_account - issue certificate with
.new_order
But after that, when I need to renew the issued cert, I already have an account enrolled, and so skip .new_account. And then, the .new_order crash:
File "/root/cozy-coclyco/cozy/coclyco/acme.py", line 275, in _issue_certificate
order = self.__acme.new_order(pem)
File "/usr/lib/python3/dist-packages/acme/client.py", line 650, in new_order
response = self._post(self.directory['newOrder'], order)
File "/usr/lib/python3/dist-packages/acme/client.py", line 94, in _post
return self.net.post(*args, **kwargs)
File "/usr/lib/python3/dist-packages/acme/client.py", line 1130, in post
return self._post_once(*args, **kwargs)
File "/usr/lib/python3/dist-packages/acme/client.py", line 1147, in _post_once
response = self._check_response(response, content_type=content_type)
File "/usr/lib/python3/dist-packages/acme/client.py", line 999, in _check_response
raise messages.Error.from_json(jobj)
acme.messages.Error: urn:ietf:params:acme:error:malformed :: The request message was malformed :: No Key ID in JWS header
Looking for this error, I see this issue, allowing querying an account without .new_account before. But I’m lost…
.query_registration take an messages.RegistrationResource as parameter, which is only creatable from .new_account. And even if possible outside this method, Registration seems requiring contact and agreement to be created, which is not available at renew time (only the account key exists on this run).
So, how is it possible to use .new_order on the case of a renew, with no email/registration and only the private account key? Seems certbot achieves this, but looking at the code, I’m not able to understand how it works…

