RSA_SIZE(3SSL)
β¨ RSA_SIZE π (the OpenSSL manual, section 3SSL, bestie!)
okay so real talk β this is a lil page from the OpenSSL manual, section 3SSL, and it's all about figuring out how big an RSA key is and how much security it's actually giving you. three functions, one vibe check. let's go π¦
πΈ NAME πΈ
RSA_size, RSA_bits, RSA_security_bits β get the RSA modulus size or the security bits. that's the whole job. iconic honestly π
β¨ SYNOPSIS β¨
first up, the include, don't forget it or nothing works, and I mean nothing π
#include <openssl/rsa.h>
now the one function that's still living her best life:
int RSA_bits(const RSA *rsa);
and thenβ¦ the deprecated girlies π. these have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value β see openssl_user_macros(7) for the deets:
int RSA_size(const RSA *rsa);
int RSA_security_bits(const RSA *rsa);
not me having to say "deprecated" three times in one page π it's giving legacy code energy, but we still support them, so.
π§ DESCRIPTION π§
RSA_bits() returns the number of significant bits. that's it, that's the tweet β¨
lowkey important rule tho: rsa and rsa->n must not be NULL. no cap, if either one is NULL you are on your own, bestie π
the remaining functions described on this page are deprecated. applications should instead useEVP_PKEY_get_size(3),EVP_PKEY_get_bits(3)andEVP_PKEY_get_security_bits(3). like, the EVP versions are the main characters now, fr fr π£
RSA_size() returns the RSA modulus size in bytes. super useful because you can use it to figure out how much memory you gotta allocate for an RSA encrypted value. think of it as the measuring tape for your malloc moment π
RSA_security_bits() returns the number of security bits of the given rsa key. see BN_security_bits(3) for the lore.
π RETURN VALUES π
short and sweet, as always:
RSA_bits()returns the number of bits in the key.RSA_size()returns the size of the modulus in bytes.RSA_security_bits()returns the number of security bits.
three functions, three numbers, zero drama π
π SEE ALSO π
that's the one, go read it, iykyk π
π HISTORY π
a little timeline moment, because we love context π°οΈ
- The
RSA_size()andRSA_security_bits()functions were deprecated in OpenSSL 3.0. - The
RSA_bits()function was added in OpenSSL 1.1.0. a legend was born β
βοΈ COPYRIGHT βοΈ
real ones always read the fine print, so here it is, verbatim, no edits π
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.
and that's the whole page, bestie! π«Ά this one shipped as 4.0.3, dated 2026-09-29, and it lives in the RSA_SIZE(3SSL) slot of the OpenSSL manual. go allocate the right amount of bytes and slay π
β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms