Showing results for 
Search instead for 
Did you mean: 

ST crypto library RSA usage error in Proteus 8 simulation


Hi there,

I'm new to the STM32 MCU and simulating RSA encryption-decryption on Proteus 8 now. Currently I am using the x-cube-crypto and STM32F401RE-Nucleo to do simulation. The source code is from:


In the Proteus 8 I chose a board of STM32F401RE connected with an LED light to debug. However, after checking step by step during the simulation, the encryption for RSA could return a SUCCESS, but the decryption part always returns a FAIL.

This thing also happened when I using the lib downloaded from, using the keys and sample ciphertext in the lib's sample project file, configuring a STM32F401VE board and running rsa_pkcs1v22. I have enabled the CRC. What I observed here is that:

cmox_initialize SUCCESS

cmox_rsa_consturct SUCCESS

encryption returns SUCCESS, output length 256, but content is NOT the same with the given one.

decryption returns FAILED

Both public key and private could be used in the encryption part, with a SUCCESS return.

The decryption part is not the case that exiting immediately. It runs for about 4 seconds, seems computation is finished.

Any help would be appreciate!

Jocelyn RICARD
ST Employee

Hello @zlai.1​ 

I'm sorry for late answer.

The X-CUBE-CRYPTOLIB is supposed to be run on real hardware. Internal checks are done.

If this is not the case, it just executes but does not return good values.

So, this could explain why it does not work in simulation

Best regards