[openssl.org #1099] Problem with keysize operations
Brad Hards wrote:
> I'm trying to determine the length (in bits) for my DSA and DH keys. I'm
> happily using RSA_size() for RSA keys, and I assumed that DSA_size and
> DH_size would do equivalent operations (based on the man page for
> BN_size_bits, which states 'If you want to know the "key size" of such a
> either use functions like RSA_size(), DH_size() and DSA_size()'..
yep, that's a bug.
> However the man page for DSA_size says that it returns the size of the
> signature (which for me is always 48 bytes or 384 bits, irrespective of the
> key parameters)
> Is there a way to determine the keylength for DSA keys and DH keys?
in case of a EVP_PKEY object EVP_PKEY_bits, otherwise
BN_num_bits(dsa->p). But as the "NOTES" section in the BN_num_bits
manpage already says this isn't really a satisfying solution, it
would be better to have functions like
size_t DSA_signature_size(const DSA *);
size_t DSA_pkey_size(const DSA *);
for this ... just a thought.
You should send a bug report to [hidden email].