Ensuring IPAddresses and IPNetworks are correctly serialized. (#818)

This commit is contained in:
kevgliss 2017-05-26 10:48:26 -07:00 committed by GitHub
parent 249ab23df4
commit 07969f7e10

View File

@ -327,7 +327,12 @@ class SubjectAlternativeNameExtension(Field):
name_type = 'DNSName'
elif isinstance(name, x509.IPAddress):
name_type = 'IPAddress'
if isinstance(value, ipaddress.IPv4Network):
name_type = 'IPNetwork'
else:
name_type = 'IPAddress'
value = str(value)
elif isinstance(name, x509.UniformResourceIdentifier):
name_type = 'uniformResourceIdentifier'