RSA_SIZE(3ossl)
π RSA_SIZE(3ossl) β bestie, let's talk modulus math π
okay so this is the manual page for RSA_SIZE(3ossl), and it's literally the trio of functions that tell you how big an RSA key is and how safe it is. small page, big vibes. let's go π¦
β¨ NAME β¨
RSA_size, RSA_bits, RSA_security_bits β get RSA modulus size or security bits π
πΈ SYNOPSIS πΈ
#include <openssl/rsa.h>
int RSA_bits(const RSA *rsa);
okay so heads up: the following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value β go peek at openssl_user_macros(7) for the tea π
int RSA_size(const RSA *rsa);
int RSA_security_bits(const RSA *rsa);
π DESCRIPTION π
RSA_bits() returns the number of significant bits. that's it, that's the whole job. slay.
important!!rsaandrsa->nmust not beNULL. like, do not pass null in here. i'm begging π«Ά
the remaining functions described on this page are deprecated, bestie. sad but true π applications should instead use EVP_PKEY_get_size(3), EVP_PKEY_get_bits(3) and EVP_PKEY_get_security_bits(3). those are the main characters now.
RSA_size() returns the RSA modulus size in bytes. it can be used to determine how much memory must be allocated for an RSA encrypted value. so like, if you're about to malloc something for an encrypted blob, this is the number you want β not too much, not too little, just right π
RSA_security_bits() returns the number of security bits of the given rsa key. see BN_security_bits(3) for more on that.
β RETURN VALUES β
RSA_bits()returns the number of bits in the key.RSA_size()returns the size of modulus in bytes.RSA_security_bits()returns the number of security bits.
three functions, three little numbers, no cap β¨
π SEE ALSO π
π HISTORY π
- the
RSA_size()andRSA_security_bits()functions were deprecated in OpenSSL 3.0. rip to a real one π - the
RSA_bits()function was added in OpenSSL 1.1.0. she's the new-ish girl but she ate π
π COPYRIGHT π
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 page, bestie!! π«Ά this was OpenSSL 3.5.9, dated 2026-09-29, and the page is RSA_SIZE(3ossl) β go forth and size your moduli responsibly πβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms