OpenSSL "Seal" in C (or via shell)
- by chpwn
I'm working on porting some PHP code to C, that contacts a web API.
The issue I've come across is that the PHP code uses the function openssl_seal(), but I can't seem to find any way to do the same thing in C or even via openssl in a call to system().
From the PHP manual on openssl_seal():
int openssl_seal ( string $data ,
string &$sealed_data , array
&$env_keys , array $pub_key_ids )
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.
What would be the best way to implement this? I'd really prefer not to call out to a PHP script every time, for obvious reasons.