MBEDTLS pkcs1 invalid padding

Hello to all!
I’m trying to enable the https server on a stm32h7 microcontroller. I’m using the lwip stack and I have no problem with http protocol. Now I would like to use the https protocol. I enabled the mbedtls module and started the web server with the httpd_inits function
I’m using a certificate and a private key in pem format that works fine if I try to install them in the apache server on a computer.
When I try to connect to the microcontroller with openssl with the command openssl s_client -connect -prexit --msg , after the ServerKeyExchange I receive these messages:
140350606644544:error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding:…/crypto/rsa/rsa_pk1.c:66:
140350606644544:error:04067072:rsa routines:rsa_ossl_public_decrypt:padding check failed:…/crypto/rsa/rsa_ossl.c:587:
140350606644544:error:1416D07B:SSL routines:tls_process_key_exchange:bad signature:…/ssl/statem/statem_clnt.c:2405:

I suppose that there’s something wrong with the key but I can’t figure out what to do to solve the problem.

Please help!

Update: I used the mbedtls_test_srv_key_rsa_pem, mbedtls_test_srv_crt_rsa_sha256_pem and the problem persists.


Did you ever manage to find a solution? I’m running into something very similar with freeradius as my target.