You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a X509 certificate class for the SSL module. Eventually methods like getpeercert() are going to return X509 instances and the Python interface can decide if it should return a dict, DER bytes or whatever. IMHO it's a mandatory requirement for OCSP support, too.
Yeah, this is probably inevitable. Major concern is how to maintain compatibility with getpeercert() currently returning a dict. Should we make X509 a dict subclass? (yikes :-))
I have slightly different plans. But first, do you agree that the _ssl C extension and all its methods are consider an internal API? How about the _ssl module's method returns X509 objects and the Python module calls methods on the X509 object like get_info() -> dict or get_der() -> bytes?
I have slightly different plans. But first, do you agree that the _ssl
C extension and all its methods are consider an internal API? How
about the _ssl module's method returns X509 objects and the Python
module calls methods on the X509 object like get_info() -> dict or
get_der() -> bytes?
Sounds fine, yes.
underrun commented on Jul 26, 2013
underrunmannequin
Mannequin
More actions
For ssl.match_hostname to work with this, you need to get the info dict first. I've attached at patch for it.
underrun commented on Jul 30, 2013
underrunmannequin
Mannequin
More actions
actually, i suppose rather than change a bunch of existing functions/methods to handle X509 certs it would make more sense to add new methods to the X509 cert class (like match_hostname) so that old stuff doesn't break.
The feature won't be ready for 3.4. I'll work on a PEP for 3.5
BreamoreBoy commented on May 5, 2015
BreamoreBoymannequin
Mannequin
More actions
Presumably too late for 3.5 so do we bump this to 3.6? Alternatively could the Derek Wilson patch make 3.5, there's nearly three weeks until beta 1 is due on 24th May according to https://www.python.org/dev/peps/pep-0478/ ?
At Christian's request and considering the importance of the ssl module, I'm going to allow an extension for landing of this feature until 3.7.0b2, currently scheduled for 2018-02-26. If anyone else can help Christian get this in before b2, that would be great.
I won't be able to land this in time for b2. It's most done but not production ready. I have only a limited amount of time and will use it to fix TLS 1.3 bits and pieces.
@tiran any chance to revive this? I'd love to help finish this work you started here.
Having access to X509 classes (and being able to parse and then pass them on from files or bytes) is a rather important feature that isn't currently possible with the standard ssl module. As you wrote many years ago this would open up the possibility to implement e.g. OCSP which is also on my bucket list of things to look into.
Activity
tiran commentedon Jul 5, 2013
I'm working on a X509 certificate class for the SSL module. Eventually methods like getpeercert() are going to return X509 instances and the Python interface can decide if it should return a dict, DER bytes or whatever. IMHO it's a mandatory requirement for OCSP support, too.
The patch contains a very real proof of concept.
pitrou commentedon Jul 5, 2013
Yeah, this is probably inevitable. Major concern is how to maintain compatibility with getpeercert() currently returning a dict. Should we make X509 a dict subclass? (yikes :-))
tiran commentedon Jul 5, 2013
A dict subclass? Oh heck ...
I have slightly different plans. But first, do you agree that the _ssl C extension and all its methods are consider an internal API? How about the _ssl module's method returns X509 objects and the Python module calls methods on the X509 object like get_info() -> dict or get_der() -> bytes?
pitrou commentedon Jul 5, 2013
Sounds fine, yes.
underrun commentedon Jul 26, 2013
For ssl.match_hostname to work with this, you need to get the info dict first. I've attached at patch for it.
underrun commentedon Jul 30, 2013
actually, i suppose rather than change a bunch of existing functions/methods to handle X509 certs it would make more sense to add new methods to the X509 cert class (like match_hostname) so that old stuff doesn't break.
tiran commentedon Oct 21, 2013
Bump up my priority. I'd like to get the feature into 3.4 as a foundation for some of my other improvements of the SSL module.
tiran commentedon Nov 17, 2013
The feature won't be ready for 3.4. I'll work on a PEP for 3.5
BreamoreBoy commentedon May 5, 2015
Presumably too late for 3.5 so do we bump this to 3.6? Alternatively could the Derek Wilson patch make 3.5, there's nearly three weeks until beta 1 is due on 24th May according to https://www.python.org/dev/peps/pep-0478/ ?
tiran commentedon May 5, 2015
I've a mostly working prototype at https://github.com/tiran/cpython/tree/feature/x509cert . It's missing documentation, more tests and I have to port it to argument clinic.
tiran commentedon Jan 12, 2018
API example:
tiran commentedon Jan 12, 2018
More examples:
ned-deily commentedon Jan 28, 2018
At Christian's request and considering the importance of the ssl module, I'm going to allow an extension for landing of this feature until 3.7.0b2, currently scheduled for 2018-02-26. If anyone else can help Christian get this in before b2, that would be great.
tiran commentedon Feb 25, 2018
I won't be able to land this in time for b2. It's most done but not production ready. I have only a limited amount of time and will use it to fix TLS 1.3 bits and pieces.
Rescheduling for 3.8
dekimsey commentedon Oct 27, 2022
Since this didn't happen for 3.8, what would need to happen to get it reconsidered for 3.11 (or a future revision)?
To work-around this, I've had to:
Doable but pretty clunky, especially since I'm accessing these internal functions.
andir commentedon Jul 24, 2023
@tiran any chance to revive this? I'd love to help finish this work you started here.
Having access to X509 classes (and being able to parse and then pass them on from files or bytes) is a rather important feature that isn't currently possible with the standard
sslmodule. As you wrote many years ago this would open up the possibility to implement e.g. OCSP which is also on my bucket list of things to look into.erlend-aasland commentedon Jan 4, 2024
The linked PR seems to be based on the withdrawn PEP-543. Since that PEP is withdrawn, is this issue still relevant?