client.errors.UnexpectedUpdate

This commit is contained in:
Jakub Warmuz 2015-03-24 17:08:25 +00:00
parent 2b4b86a41b
commit 144baf64fe
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA
2 changed files with 13 additions and 1 deletions

View file

@ -5,6 +5,14 @@ class LetsEncryptClientError(Exception):
"""Generic Let's Encrypt client error."""
class NetworkError(LetsEncryptClientError):
"""Network error."""
class UnexpectedUpdate(NetworkError):
"""Unexpected update."""
class LetsEncryptReverterError(LetsEncryptClientError):
"""Let's Encrypt Reverter error."""

View file

@ -7,6 +7,8 @@ import requests
from letsencrypt.acme import jose
from letsencrypt.acme import messages2
from letsencrypt.client import errors
class Network(object):
"""ACME networking.
@ -47,7 +49,9 @@ class Network(object):
uri=response.headers['location'],
new_authz_uri=response.links['next']['url'],
terms_of_service=terms_of_service)
assert regr.body.key == self.key.public()
if regr.body.key != self.key.public() or regr.body.contact != contact:
raise errors.UnexpectedUpdate(regr)
return regr