src/OpenSSL/crypto.py
def get_components(self):
        """
        Returns the components of this name, as a sequence of 2-tuples.

        :return: The components of this name.
        :rtype: :py:class:`list` of ``name, value`` tuples.
        """
        result = []
        for i in range(_lib.X509_NAME_entry_count(self._name)):
            ent = _lib.X509_NAME_get_entry(self._name, i)

            fname = _lib.X509_NAME_ENTRY_get_object(ent)
            fval = _lib.X509_NAME_ENTRY_get_data(ent)

            nid = _lib.OBJ_obj2nid(fname)
            name = _lib.OBJ_nid2sn(nid)

            # ffi.string does not handle strings containing NULL bytes
            # (which may have been generated by old, broken software)
            value = _ffi.buffer(_lib.ASN1_STRING_data(fval),
                                _lib.ASN1_STRING_length(fval))[:]
            result.append((_ffi.string(name), value))

        return result
def get_components(self):
        result = []
        for i in range(_lib.X509_NAME_entry_count(self._name)):
            ent = _lib.X509_NAME_get_entry(self._name, i)

            fname = _lib.X509_NAME_ENTRY_get_object(ent)
            fval = _lib.X509_NAME_ENTRY_get_data(ent)

            nid = _lib.OBJ_obj2nid(fname)
            name = _lib.OBJ_nid2sn(nid)

            # ffi.string does not handle strings containing NULL bytes
            # (which may have been generated by old, broken software)
            value = _ffi.buffer(_lib.ASN1_STRING_data(fval),
                                _lib.ASN1_STRING_length(fval))[:]
            result.append((_ffi.string(name), value))

        return result
def get_components ( self ) : result = [ ] for i in range ( _lib . X509_NAME_entry_count ( self . _name ) ) : ent = _lib . X509_NAME_get_entry ( self . _name , i ) fname = _lib . X509_NAME_ENTRY_get_object ( ent ) fval = _lib . X509_NAME_ENTRY_get_data ( ent ) nid = _lib . OBJ_obj2nid ( fname ) name = _lib . OBJ_nid2sn ( nid ) # ffi.string does not handle strings containing NULL bytes # (which may have been generated by old, broken software) value = _ffi . buffer ( _lib . ASN1_STRING_data ( fval ) , _lib . ASN1_STRING_length ( fval ) ) [ : ] result . append ( ( _ffi . string ( name ) , value ) ) return result
Returns the components of this name, as a sequence of 2-tuples.

        :return: The components of this name.
        :rtype: :py:class:`list` of ``name, value`` tuples.
Returns the components of this name as a sequence of 2 - tuples .