I created a key-pair using the RSA_generate_key() API
and wrote the public key to a file using PEM_write_RSAPublicKey() API
.
When I use the the following openssl
command to encrypt data,
openssl rsautl -encrypt -pkcs -inkey pubkey.pem -pubin -in encme.data >
encrytedyou.data
I get,
Unable to load public key.
However, when I use the:-
RSA_private_decrypt(encrypt_len, encrypt, decrypt, keypair,
RSA_PKCS1_PADDING)
The encrypted data get successfully decrypted.
How should I convert the public key to a format compatible with openssl?
Thanks