<div dir="ltr">Dear Andrew,<div><br></div><div>You should take a look at CMS implementation as a model. </div><div><br></div><div>For example, you can generate a symmetric key for content encryption and </div><div>algorithm-specific way to pass the symmetric key to the recipient using EVP_PKEY_encrypt.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 1, 2020 at 7:35 PM Andrew Felsher <<a href="mailto:ncsuandrew12@gmail.com">ncsuandrew12@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm trying to do what I assumed would be a very common and typical use of <span>OpenSSL</span>. I'm just encrypting and decrypting some data (in code; not from command line). EVP_EncryptInit_ex (and decrypt, update, and final variants) are the standard way to do this.</div><div><br></div><div>However, the init functions take a char buffer. All the examples I can find use hard-coded char buffer keys. But obviously I'm not going to be hard-coding my keys. I'm generating them through a couple different means, but ultimately I have EVP_PKEYs (in my case, containing RSA private keys). And there doesn't seem to be a straightforward way to go from EVP_PKEYs to a form consumable by the EVP init functions.</div><div><br></div><div>EVP_PKEY_get_raw_private_key looks like it would be perfect, but it was introduced in 1.1.1 and I'm limited to 1.1.0.</div><div><br></div><div>This seems like it would be a very common use case, yet I can't seem to find any examples or documentation anywhere.</div><div><br></div><div>Am I doing something wrong or making some really off-base assumptions?</div><div><br></div><div>Thanks for any help, pointers, or guidance,</div><div>Andrew F</div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">SY, Dmitry Belyavsky</div>