-
Notifications
You must be signed in to change notification settings - Fork 167
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
Returns keysize in bits #691
base: master
Are you sure you want to change the base?
Conversation
…eeded for key such as X25519 where the size not in byte boundary
GitHub Actions is failing because EVP_PKEY_get_bits() exists only in OpenSSL >= 3.0. It apparently had a different name in older versions according to the manpage. The manpage of EVP_PKEY_get_bits() seems to deliberately avoid "key size". Probably this is because it's not a very well defined term.
I prefer not to name this method |
Thanks for the time Kazuki San. Is it acceptable I put the #ifdef to make it only support when it is compiled with OpenSSL >= 3.0 or I need to support OpenSSL < 3.0? Thanks! Regards |
The manpage says |
…nSSL versions. Also the spec seems only specified the key length of public key, no mention of private key size
…urns different value then the rest of the versions
There are some situation the actual key size in bits are required, for example for display or analysis.
For EC/RSA etc, the key size is fixed which is not really useful. However recently I've been working on X25519 key and the key size is at odd 253, not at byte boundary. Projected there will more situation like this in coming use cases where key size in bit is more desirable especially when PQ key get involved.
The method keysize_in_bits() attached to OpenSSL::PKey class shall be available to all PKey type and it is just returning the key size in bits.