Repository navigation
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
| # frozen_string_literal: true | ||
| require_relative "utils" | ||
|
|
||
| require_relative 'utils' |
There was a problem hiding this comment.
Please don't include cosmetic changes in the irrelevant part of the file.
There was a problem hiding this comment.
Sorry was added by rubocop. I think better to have the .rubocop.yml in the project so everyone has the same rules? Just a suggestion. For now I've disabled all rules in .rubocop.yml
|
Sorry for not following up earlier. (This PR was blocked due to the unrelated diffs.) I'm closing this PR for now. I don't think this is a generally useful function to expose. There is a somewhat related issue for The same value can currently be obtained via |
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.