A: 

From reading the documentation on openssl_pkey_get_private it appears you need to specify the full (absolute) path.

Using URL::site would append http:// and thus you would get:

file://http://localhost/../../private/private

which is invalid. I guess that causes your next function call to fail. The solution would be to either

  1. Load the private key into a string and pass that or
  2. Use a function like realpath to get the absolute path.

PS: Don't forget to accept correct answers otherwise you'll get a lower response rate in the future.

The Pixel Developer
A: 

Pixel has the right diagnosis. You'll end up wanting to something like this:

openssl_pkey_get_public('file://' .APPPATH. 'private/public');

The path constants like this are defined in index.php.

Lethargy