-
Notifications
You must be signed in to change notification settings - Fork 172
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
Strange behavior on OpenSSL::SSL::SSLSocket#tmp_key
, wrong class returned
#360
Comments
OpenSSL::SSL::SSLSocket#tmp_key
OpenSSL::SSL::SSLSocket#tmp_key
, wrong class returned
OpenSSL::SSL::SSLSocket#tmp_key will return the generic OpenSSL::PKey when it's representable neither by OpenSSL::PKey::DH nor by OpenSSL::PKey::EC. For example, X25519 falls in this category. The test code disables X25519 explicitly (commit a001911). The difference between Ruby 2.3 and 2.6 must be the OpenSSL library version linked with. X25519 was first supported by OpenSSL 1.1.0. |
I got the same result with ECDHE cipher… 🤔 |
TLS's ECDH key exchange can use X25519, but OpenSSL treats it separately in the EVP layer. To prevent X25519 from being chosen (to set the elliptic_curves extension in the TLS Client Hello, which by default includes X25519), you can use OpenSSL::SSL::SSLContext#ecdh_curves=. |
Oh ok, thanks, will do more test on my side to check this. |
Seems working! |
At the moment, yes. There is no way to tell what type of key is an OpenSSL::PKey::PKey holding. This seems a missing feature. #364 adds #oid (and overrides #inspect). |
According to unit tests,
OpenSSL::SSL::SSLSocket#tmp_key
is supposed to returnOpenSSL::PKey::EC
orOpenSSL::PKey::DH
.I add some debug on unit test:
And then run them, all are good and the expected class are correctly seen:
But when executed on real code
We get a bare
OpenSSL::PKey::PKey
only on 2.6, not on 2.3 🤔I don't understand this behavior and why unit test result are different from real code result, and why different behavior from one ruby version to another…
The text was updated successfully, but these errors were encountered: