mbedtls_rsa_rsaes_pkcs1_v15_decrypt() function
This function performs a PKCS#1 v1.5 decryption operation (RSAES-PKCS1-v1_5-DECRYPT). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
Arguments
ctx
The initialized RSA context to use.
f_rng
The RNG function. If \p mode is #MBEDTLS_RSA_PRIVATE, this is used for blinding and should be provided; see mbedtls_rsa_private() for more. If \p mode is #MBEDTLS_RSA_PUBLIC, it is ignored.
p_rng
The RNG context to be passed to \p f_rng. This may be \c NULL if \p f_rng is \c NULL or doesn't need a context.
mode
The mode of operation. This must be either #MBEDTLS_RSA_PRIVATE or #MBEDTLS_RSA_PUBLIC (deprecated).
olen
The address at which to store the length of the plaintext. This must not be \c NULL.
The ciphertext buffer. This must be a readable buffer of length \c ctx->len Bytes. For example, \c 256 Bytes for an 2048-bit RSA modulus.
output
The buffer used to hold the plaintext. This must be a writable buffer of length \p output_max_len Bytes.
output_max_len
The length in Bytes of the output buffer \p output.
Return value
\c 0 on success. An \c MBEDTLS_ERR_RSA_XXX error code on failure.
Notes
The output buffer length \c output_max_len should be as large as the size \p ctx->len of \p ctx->N, for example, 128 Bytes if RSA-1024 is used, to be able to hold an arbitrary decrypted message. If it is not large enough to hold the decryption of the particular ciphertext provided, the function returns #MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE. Alternative implementations of RSA need not support mode being set to #MBEDTLS_RSA_PUBLIC and might instead return #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED.