def name_to_dict(name):
    """Convert OpenSSL x509Name to dict object.
    Creates a dict with all the components of the x509Name object and
    returns it.
    """
    result = {}
    for (key,value) in name.get_components():
        result[key] = value
    return result