libressl-RSA_size(3)

libressl-RSA_size3

Get the rsa modulus size

Usage

Crypto Library (libcrypto, -lcrypto)

#include <openssl/rsa.h>

int

RSA_size(const RSA *rsa);

int

RSA_bits(const RSA *rsa);

Overview

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.

RSA_bits() returns the number of significant bits.

rsa and rsa->n must not be NULL.

Return values

The size.

History

RSA_size() first appeared in SSLeay 0.4.4 and has been available since OpenBSD 2.4.

RSA_bits() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3.

From libressl 4.4.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's mdoc source.