mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 08:45:22 +02:00
Inlining
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""ACME Identifier Validation Challenges."""
|
||||
import binascii
|
||||
import functools
|
||||
import hashlib
|
||||
|
||||
@@ -106,12 +107,12 @@ class DVSNI(DVChallenge):
|
||||
@property
|
||||
def nonce_domain(self):
|
||||
"""Domain name used in SNI."""
|
||||
return self._encode_hex16(self.nonce) + self.DOMAIN_SUFFIX
|
||||
return binascii.hexlify(self.nonce) + self.DOMAIN_SUFFIX
|
||||
|
||||
def _fields_to_json(self):
|
||||
return {
|
||||
"r": jose.b64encode(self.r),
|
||||
"nonce": self._encode_hex16(self.nonce),
|
||||
"nonce": binascii.hexlify(self.nonce),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -42,12 +42,10 @@ class Message(util.TypedACMEObject):
|
||||
raise errors.ValidationError("missing type field")
|
||||
|
||||
try:
|
||||
msg_cls = cls.TYPES[msg_type]
|
||||
return cls.TYPES[msg_type]
|
||||
except KeyError:
|
||||
raise errors.UnrecognizedTypeError(msg_type)
|
||||
|
||||
return msg_cls
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, jobj):
|
||||
"""Deserialize from (possibly invalid) JSON object.
|
||||
|
||||
@@ -112,10 +112,6 @@ class ACMEObject(ImmutableMap): # pylint: disable=too-few-public-methods
|
||||
|
||||
return decoded
|
||||
|
||||
@classmethod
|
||||
def _encode_hex16(cls, data):
|
||||
return binascii.hexlify(data)
|
||||
|
||||
@classmethod
|
||||
def _decode_hex16(cls, data, size=None, minimum=False):
|
||||
if size is not None and ((not minimum and len(data) != size * 2)
|
||||
|
||||
@@ -160,10 +160,6 @@ class ACMEObjectTest(unittest.TestCase):
|
||||
self.assertRaises(errors.ValidationError, ACMEObject._decode_b64jose,
|
||||
'Zm9v', size=4, minimum=True)
|
||||
|
||||
def test_encode_hex16(self):
|
||||
from letsencrypt.acme.util import ACMEObject
|
||||
self.assertEqual('666f6f', ACMEObject._encode_hex16('foo'))
|
||||
|
||||
def test_decode_hex16(self):
|
||||
from letsencrypt.acme.util import ACMEObject
|
||||
self.assertEqual('foo', ACMEObject._decode_hex16('666f6f'))
|
||||
|
||||
Reference in New Issue
Block a user