-
Notifications
You must be signed in to change notification settings - Fork 32
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
Provide a SSLContext() API #19
Comments
FWIW, in theory an an SSLContext + SSLObject API would allow this to work with asyncio. Sadly, I haven't managed to make that work with the above code, however. The OpenSSL library calls are never made and I haven't figured out why yet... |
This makes it possible to add PSK support to paho-mqtt client. |
I'm trying to make work the proposed by @paravoid on the paho-mqtt client. So far I haven't been able to achieve it. Here is what I have done so far: https://github.com/maovidal/paho_sslpsk2_demo/blob/main/paho_sslpsk2_demo.py Any help would be much appreciated. |
Wouldn't it be great to see this whole thing as an effort against python/cpython#63284 It states:
|
@drbild I just submitted a tested PR with this fix and this works great. I would really appreciate it if you could review it |
The Python ssl module documentation says:
It'd be nice if sslpsk followed suit and provided a similar API. It seems that 3.7+ provides some core API improvements that would make this possible. I played around and this seemed to work:
(It seems like SSLPSKSocket alone is useful to replace the existing functionality. I think SSLPSKObject is useful only under certain frameworks. I could not test that, so perhaps it'd be smarter to even avoid including that for now.)
With that, one can use
SSLPSKContext
where they'd useSSLContext
before, andSSLPSKContext.psk = …
to set the PSK (and.hint = …
for the hint).A backwards-compatible
sslpsk.wrap_socket()
can still be offered with:The text was updated successfully, but these errors were encountered: