[Python-Dev] frozenset C API? (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Wed Sep 5 19:24:35 CEST 2007


There's a field on the X509NAMEENTRY struct which gives the level. OK, I can make it a tuple (list of RDNs) of tuples (one for each RDN) of tuples (one for each attribute in the RDN). And maybe add a flatten function to the ssl.py module :-).

See my other proposal as well. As nobody actually uses multi-valued RDNs, an option would be to make single tuple for each RDN, containing all attributes, with alternatingly type and value. Then, a single-valued RDN would turn out as a key-value pair (two-tuple), a multi-valued RDN would have a length of 2*number-of-attributes.

As for accessor functions, I'd then rather see a get_attr_by_type, returning a list of all values of attributes of that type, across all RDNs in the DN (empty if no attribute was found). People would then do

x = get_attr_by_type(subj, ssl.commonName) if len(x) != 1: unsupported_certificate() CN = x[0]

Regards, Martin



More information about the Python-Dev mailing list