Python cryptography.x509.RFC822Name() Examples
The following are 1
code examples of cryptography.x509.RFC822Name().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cryptography.x509
, or try the search function
.
Example #1
Source File: fields.py From lemur with Apache License 2.0 | 5 votes |
def _serialize(self, value, attr, obj): general_names = [] name_type = None if value: for name in value._general_names: value = name.value if isinstance(name, x509.DNSName): name_type = "DNSName" elif isinstance(name, x509.IPAddress): if isinstance(value, ipaddress.IPv4Network): name_type = "IPNetwork" else: name_type = "IPAddress" value = str(value) elif isinstance(name, x509.UniformResourceIdentifier): name_type = "uniformResourceIdentifier" elif isinstance(name, x509.DirectoryName): name_type = "directoryName" elif isinstance(name, x509.RFC822Name): name_type = "rfc822Name" elif isinstance(name, x509.RegisteredID): name_type = "registeredID" value = value.dotted_string else: current_app.logger.warning( "Unknown SubAltName type: {name}".format(name=name) ) continue general_names.append({"nameType": name_type, "value": value}) return general_names