Skip to content

Conversation

@BrokenDuck
Copy link

Rationale

On Mac OS, the load_default_certs SSLContext method does not load the system root certificate. In order for the get_ca_certs method to work properly on mac os, we need to override the load_defaults_certs method on Mac OS.

Method

We extract the certificates using the Security Framework, with the SecTrustCopyAnchorCertificates function. We then load the certificates using the load_verify_location SSLContext method which accepts DER-encoded byte-like certificates in the cadata argument.

@jmaillefaud
Copy link

Pinging @sethmlarson

Copy link
Owner

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the justification in the pull request description:

In order for the get_ca_certs method to work properly on mac os, we need to override the load_defaults_certs method on Mac OS.

I don't think this is correct? get_ca_certs() returns whatever certificates are loaded, in the case of Truststore it's whatever has been loaded manually plus the system certificates. We don't need load_default_certs() implemented for this to work.

Truststore on its own should behave as if load_default_certs() has already been called on all truststore.SSLContext() objects, as the default behavior is to use the system certificates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants