I've looked around and found scant information on encryption on Mac OS X. It seems like OpenSSL support is deprecated in newer version of Mac OS X. I need to be able to support from 10.5 and up. Here's my problem:
I have a public and private key pair generate on our licensing server using php (code shown below)
$dn = array(configs....);
$privkey = openssl_pkey_new();
$csr = openssl_csr_new($dn, $privkey);
$sscert = openssl_csr_sign($csr, null, $privkey, $term);
openssl_x509_export($sscert, $publickey);
openssl_pkey_export($privkey, $privatekey, "somepassphrase");
//base64 encode the keys
$privatekey = base64_encode($privatekey);
$publickey = base64_encode($publickey);
The base64 encoded private key is stored in a secure location on one of our servers and the base64 encoded public key is written to a file for download by our users. The file is loaded into a desktop application for MacOS X written in cocoa, which base64 decodes the public key. Until this step is good. However, I want to then encrypt data with the public key and send it to our license server. Does anyone know how I can use this public key to encrypt data in cocoa and what is the "best" practice method? Any examples or tips would be much appreciated!