[OpenSSL 3.1.4][fips and base provider] Wrong public key size from deprecated API for DSA certificate.
Ma Zhenhua <[email protected]>
| Newsgroups | gmane.comp.encryption.openssl.user |
|---|---|
| Message-ID | <SY7P300MB05853C3B73DE70B3C9335FA3AA192@SY7P300MB0585.AUSP300.PROD.OUTLOOK.COM> |
I use below code to get the public key size of DSA certificate and the result is wrong.
int get_public_key_size(X509 *x509)
{
EVP_PKEY *pkey=NULL;
pkey = X509_get_pubkey(x509);
DSA *dsa = EVP_PKEY_get1_DSA(pkey);
if (dsa) {
const BIGNUM *pub_key = NULL;
DSA_get0_key(dsa, &pub_key, NULL);
int pub_key_size = BN_num_bits(pub_key);
}
...
}
However for a DSA certificate of 2048 bit public key size. The result is 2047.
The APIs marked red are deprecated, but similar APIs for RSA and ECDSA certificate could get the right result.
--
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/SY7P300MB05853C3B73DE70B3C9335FA3AA192%40SY7P300MB0585.AUSP300.PROD.OUTLOOK.COM.