mbedtls_rsa_export() function
This function exports the core parameters of an RSA key. If this function runs successfully, the non-NULL buffers pointed to by \p N, \p P, \p Q, \p D, and \p E are fully written, with additional unused space filled leading by zero Bytes. Possible reasons for returning #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED: An alternative RSA implementation is in use, which stores the key externally, and either cannot or should not export it into RAM. A SW or HW implementation might not support a certain deduction. For example, \p P, \p Q from \p N, \p D, and \p E if the former are not part of the implementation. If the function fails due to an unsupported operation, the RSA context stays intact and remains usable.
Arguments
ctx
The initialized RSA context.
N
The MPI to hold the RSA modulus. This may be \c NULL if this field need not be exported.
P
The MPI to hold the first prime factor of \p N. This may be \c NULL if this field need not be exported.
Q
The MPI to hold the second prime factor of \p N. This may be \c NULL if this field need not be exported.
D
The MPI to hold the private exponent. This may be \c NULL if this field need not be exported.
E
The MPI to hold the public exponent. This may be \c NULL if this field need not be exported.
Return value
\c 0 on success. #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED if exporting the requested parameters cannot be done due to missing functionality or because of security policies. A non-zero return code on any other failure.