Parsing RSA2048 certificate fails with error code MBEDTLS_ERR_PK_INVALID_PUBKEY


I am trying to parse this AWS IoT Certificate provided by Amazon.
Every time I call mbedtls_x509_crt_parse() I get the error code MBEDTLS_ERR_PK_INVALID_PUBKEY.

I am not sure if I have the correct RSA configuration enabled.
My environment is within an RTOS, originally I was only using ECC certificate so I had disable all RSA related configuration. But now when I enable them this is the error code I get, please let me know the configuration that are required.


Solved. My MPI size was incorrect for the RSA key size.
Has to use a MPI size 256.
I had adjusted the MPI to reduce memory