-
Notifications
You must be signed in to change notification settings - Fork 34
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
Create an ssl.SSLContext
#20
Comments
@vog is this a change you would be open to? If so I'd be happy to handle the actual implementation. |
Yes, I'm open to that change, but would like to propose an even more preferable solution: Please try to get our code included directly in httpx. As stated in our README, this So, please open an issue in |
I like that plan. I will open an issue there and reference this thread. If you are amenable I'd still like to do a PR here to show a reference implementation to help streamline the discussion. |
Of course, feel free to propose a pull request. I'd prefer a separate function next to create_ssl_context, perhaps moving common code into a third internal function. Feel free to rename the functions as you see fit (e.g. create_pyopenssl_context(), create_ssl_sslcontext() or similar) |
@vog and @kafonek , I wanted to get a quick opinion. The existing implementation of the
Thoughts? |
@rashley-iqt - If I'm reading right, I do think it's a good idea to have any new function that returns an
|
yes so the current method, which i think should be renamed to |
Got it, thanks @rashley-iqt. If I have an encrypted .p12 file on disk already, would the workflow then look like the following? data = open('/my/bundle.p12', 'rb').read()
pw = input('pki password: ').encode('utf8')
ctx = create_ssl_ssl_context(data, pw)
### ^^ that step creates and destroys a tempfile with the decrypted p12 or converted to pem?
client = httpx.Client(verify=ctx)
resp = client.get(pki_required_url) That sounds reasonable to me. I believe |
I strongly advice against creating temporary files. However, if there's absolutely no way around it, I'd like to propose two things:
|
@kafonek, @rashley-iqt: It there anything left to do for the requests_pkcs12 project here? |
@vog I still think it is a good idea for |
I don't think this is outside the scope of this project. This library is very small, so making it fit for (I just noted in previous comments that inclusion in the In other words: Patches and/or pull requests regarding |
I have some code to turn into a PR for this use case. I just need to block out time to get it tested. I apologize for the delay, I don't want this to languish. |
just sent you a PR @vog |
Sorry I just noticed this is still open while pointing someone else to this project. @rashley-iqt thank you for adding this! @vog I am good with this being closed if you are. |
httpx is growing in popularity as the "next generation"
requests.py
. It can accept customssl.SSLContext
objects but notPyOpenSSLContext
, encode/httpx#924.create_ssl_context
returns aPyOpenSSLContext
. Could that optionally return anssl.SSLContext
or another function added for that support?Thanks.
The text was updated successfully, but these errors were encountered: