RSA_public_decrypt fails when using RSA_set0_key(key, n,e,d)?

Viewed 1743

I have the n, e, d component from other devices not the OpenSSL. I want to encrypt and decrypt using the OpenSSL API. But decrypt always fails after encrypt.

I use RSA_set0_key for private key (n, e, d) setting, and RSA_private_encrypt is OK, but RSA_public_decrypt fails always. I wonder why it fails.

Why does RSA_public_decrypt fail?

2 Answers
Related