-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
X509 cert with GEN_RID subject alt name causes SytemError #71878
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
Comments
A X509 cert with a registered id general name in subject alternative name causes a SystemError: error return without exception set. This prevents host name validation of certs with a registered id. >>> import _ssl
>>> _ssl._test_decode_cert('rid.pem')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: error return without exception set The problem is caused by a bug in OpenSSL's print function for general names. Python's _get_peer_alt_names() uses GENERAL_NAME_print() to print GEN_IPADD, GEN_RID and others into a buffer. The buffer is then split at ':' into two strings. This works for all fields except for GEN_RID because OpenSSL doesn't put a ':' after 'Registered ID', https://github.com/openssl/openssl/blob/master/crypto/x509v3/v3_alt.c#L183 . _get_peer_alt_names() fails and returns NULL without setting a proper exception. It looks like we haven't had tests for GEN_RID as well as some other field types. Related Red Hat bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1364268 |
ping |
I can't comment on this, as I don't even know what a "registered id" is, sorry :-/ |
A GEN_RID is an OID plus some opaque data. It's up to an application to understand an OID and interpret its data. The value of a GEN_RID can be as simple as an int or UTF-8 strings or as complex as a nested ASN.1 struct for Kerberos principals. I have modified Lib/test/make_ssl_certs.py to include two GEN_RIDS: otherName.1 = 1.2.3.4;UTF8:some other identifier
otherName.2 = 1.3.6.1.5.2.2;SEQUENCE:princ_name [princ_name] 1.3.6.1.5.2.2 is the OID for Kerberos public key init (pkinit), used for e.g. FAST pre-auth and SmartCard authentication. |
New changeset 9bbf0b31da48 by Christian Heimes in branch '3.5': New changeset 2b9af57af3e4 by Christian Heimes in branch 'default': New changeset 74805fd9e734 by Christian Heimes in branch '2.7': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: