def __getattr__(self, name):
        """
        Find attribute. An X509Name object has the following attributes:
        countryName (alias C), stateOrProvince (alias ST), locality (alias L),
        organization (alias O), organizationalUnit (alias OU), commonName
        (alias CN) and more...
        """
        nid = _lib.OBJ_txt2nid(_byte_string(name))
        if nid == _lib.NID_undef:
            # This is a bit weird.  OBJ_txt2nid indicated failure, but it seems
            # a lower level function, a2d_ASN1_OBJECT, also feels the need to
            # push something onto the error queue.  If we don't clean that up
            # now, someone else will bump into it later and be quite confused.
            # See lp#314814.
            try:
                _raise_current_error()
            except Error:
                pass
            return super(X509Name, self).__getattr__(name)

        entry_index = _lib.X509_NAME_get_index_by_NID(self._name, nid, -1)
        if entry_index == -1:
            return None

        entry = _lib.X509_NAME_get_entry(self._name, entry_index)
        data = _lib.X509_NAME_ENTRY_get_data(entry)

        result_buffer = _ffi.new("unsigned char**")
        data_length = _lib.ASN1_STRING_to_UTF8(result_buffer, data)
        _openssl_assert(data_length >= 0)

        try:
            result = _ffi.buffer(
                result_buffer[0], data_length
            )[:].decode('utf-8')
        finally:
            # XXX untested
            _lib.OPENSSL_free(result_buffer[0])
        return result
def __getattr__ ( self , name ) : nid = _lib . OBJ_txt2nid ( _byte_string ( name ) ) if nid == _lib . NID_undef : try : _raise_current_error ( ) except Error : pass return super ( X509Name , self ) . __getattr__ ( name ) entry_index = _lib . X509_NAME_get_index_by_NID ( self . _name , nid , - 1 ) if entry_index == - 1 : return None entry = _lib . X509_NAME_get_entry ( self . _name , entry_index ) data = _lib . X509_NAME_ENTRY_get_data ( entry ) result_buffer = _ffi . new ( "unsigned char**" ) data_length = _lib . ASN1_STRING_to_UTF8 ( result_buffer , data ) _openssl_assert ( data_length >= 0 ) try : result = _ffi . buffer ( result_buffer [ 0 ] , data_length ) [ : ] . decode ( 'utf-8' ) finally : _lib . OPENSSL_free ( result_buffer [ 0 ] ) return result
Find attribute. An X509Name object has the following attributes:
        countryName (alias C), stateOrProvince (alias ST), locality (alias L),
        organization (alias O), organizationalUnit (alias OU), commonName
        (alias CN) and more...