title: OpenSSL "Seal" in C (or via shell)
body: <p>I'm working on porting some PHP code to C, that contacts a web API.</p>
  
  <p>The issue I've come across is that the PHP code uses the function <code>openssl_seal()</code>, but I  can't seem to find any way to do the same thing in C or even via <code>openssl</code> in a call to <code>system()</code>.</p>
  
  <p>From the PHP manual on <code>openssl_seal()</code>:</p>
  
  <blockquote>
    <p>int openssl_seal  ( string $data  ,
    string &amp;$sealed_data  , array
    &amp;$env_keys  , array $pub_key_ids  )</p>
    
    <p>openssl_seal() seals (encrypts) data
    by using RC4 with a randomly generated
    secret key. The key is encrypted with
    each of the public keys associated
    with the identifiers in pub_key_ids
    and each encrypted key is returned in
    env_keys . This means that one can
    send sealed data to multiple
    recipients (provided one has obtained
    their public keys). Each recipient
    must receive both the sealed data and
    the envelope key that was encrypted
    with the recipient's public key.</p>
  </blockquote>
  
  <p>What would be the best way to implement this? I'd really prefer <em>not</em> to call out to a PHP script every time, for obvious reasons.</p>