I have a symmetric key that I would like to encrypt with an ECC public key using OpenSSL. In its high-level portion, EVP, OpenSSL offers a solution to encrypt "an envelop", which is exactly what I need.
However, I would like to have these in separate steps, not all in one, as OpenSSL offers in EVP. I would like to have control where I encrypt the symmetric key myself with OpenSSL, and encrypt the message using my own C++ wrappers, and put them both in my selected format.
How can I encrypt the just symmetric key with a public key using OpenSSL without having it encrypt the message as well? Is this doable?
I've tried to have zero-length plaintext in the example provided, but it crashes. Is this possible?
If not, how can I encrypt with a public key without EVP with an EC_KEY
?