Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL: add OID / NID lookup #63647

Closed
tiran opened this issue Oct 30, 2013 · 9 comments
Closed

SSL: add OID / NID lookup #63647

tiran opened this issue Oct 30, 2013 · 9 comments
Assignees
Labels
type-feature A feature request or enhancement

Comments

@tiran
Copy link
Member

tiran commented Oct 30, 2013

BPO 19448
Nosy @pitrou, @giampaolo, @tiran, @dstufft
Files
  • ssl_asn1obj.patch
  • ssl_asn1obj2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tiran'
    closed_at = <Date 2013-11-17.19:10:22.637>
    created_at = <Date 2013-10-30.09:55:08.439>
    labels = ['type-feature']
    title = 'SSL: add OID / NID lookup'
    updated_at = <Date 2013-11-22.15:21:03.639>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2013-11-22.15:21:03.639>
    actor = 'python-dev'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2013-11-17.19:10:22.637>
    closer = 'christian.heimes'
    components = []
    creation = <Date 2013-10-30.09:55:08.439>
    creator = 'christian.heimes'
    dependencies = []
    files = ['32423', '32451']
    hgrepos = []
    issue_num = 19448
    keywords = ['patch']
    message_count = 9.0
    messages = ['201724', '201916', '203151', '203154', '203199', '203200', '203208', '203209', '203784']
    nosy_count = 6.0
    nosy_names = ['janssen', 'pitrou', 'giampaolo.rodola', 'christian.heimes', 'python-dev', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19448'
    versions = ['Python 3.4']

    @tiran
    Copy link
    Member Author

    tiran commented Oct 30, 2013

    For bpo-17134 I need a decent way to map OIDs to human readable strings and vice versa. OpenSSL has a couple of method for the task, e.g. http://www.openssl.org/docs/crypto/OBJ_nid2obj.html

    The patch implements three ways to lookup NID, SN, LN and OID: by OpenSSL's internal numeric id (NID), by OID or by name:

    >>> ssl.txt2obj("MD5", name=True)
    ASN1Object(nid=4, shortname='MD5', longname='md5', oid='1.2.840.113549.2.5')
    >>> ssl.txt2obj("clientAuth", name=True)
    ASN1Object(nid=130, shortname='clientAuth', longname='TLS Web Client Authentication', oid='1.3.6.1.5.5.7.3.2')
    >>> ssl.txt2obj("1.3.6.1.5.5.7.3.1")
    ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')

    @tiran tiran added the type-feature A feature request or enhancement label Oct 30, 2013
    @tiran
    Copy link
    Member Author

    tiran commented Nov 1, 2013

    Thanks for the feed back! The new patch implements a class with two additional class methods. The low level functions are no longer part of the public API.

    @tiran
    Copy link
    Member Author

    tiran commented Nov 17, 2013

    Does anybody want to do a review of the patch?

    @pitrou
    Copy link
    Member

    pitrou commented Nov 17, 2013

    If it's for bpo-17134, couldn't it remain a private API?

    I'm rather uncomfortable about exposing such things unless we make the ssl module a full-fledged toolbox to handle X509 certificates (and perhaps think a bit more about the APIs). Are there any common use cases?

    @tiran
    Copy link
    Member Author

    tiran commented Nov 17, 2013

    OK, let's keep it as private API for now and maybe make it public in 3.5. I'm going to rename ASN1Object to _ASN1Object, remove the docs and adjust the tests. Agreed?

    @pitrou
    Copy link
    Member

    pitrou commented Nov 17, 2013

    OK, let's keep it as private API for now and maybe make it public in
    3.5. I'm going to rename ASN1Object to _ASN1Object, remove the docs
    and adjust the tests. Agreed?

    Yup.

    @tiran tiran self-assigned this Nov 17, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 17, 2013

    New changeset f43f65038e2a by Christian Heimes in branch 'default':
    Issue bpo-19448: Add private API to SSL module to lookup ASN.1 objects by OID, NID, short name and long name.
    http://hg.python.org/cpython/rev/f43f65038e2a

    @tiran
    Copy link
    Member Author

    tiran commented Nov 17, 2013

    Thanks!

    @tiran tiran closed this as completed Nov 17, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 22, 2013

    New changeset 7d914d4b05fe by Christian Heimes in branch 'default':
    Issue bpo-19448: report name / NID in exception message of ASN1Object
    http://hg.python.org/cpython/rev/7d914d4b05fe

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants