Problem with openssl_get_privatekey returning false

Posted by Joe Corkery on Stack Overflow See other posts from Stack Overflow or by Joe Corkery
Published on 2010-05-17T15:26:06Z Indexed on 2010/05/17 15:30 UTC
Read the original article Hit count: 641

Filed under:
|
|

I am trying to generate a signed url for Amazon's CloudFront service but am running into problems in that the openssl_get_privatekey function appears to be returning false and I can't quite figure out why. Here is the code (PHP) that I am using:

$priv_key = file_get_contents(path_to_my_pem_file);
$priv_keyid = openssl_get_privatekey($privkey);

Unfortunately, everytime I try this openssl_get_privatekey fails silently and I run into errors when I try to sign with openssl_sign later on.

I've tried printing out the contents of $priv_key after it has been read in and it appears to be correct. I'm running this on RHEL 5.4 using PHP 5.2.13. I've confirmed that file pem file is readable and I've also run dos2unix on it just in case (didn't work before or after).

Any thoughts would be greatly appreciated as I am relatively new to both PHP and openssl.

© Stack Overflow or respective owner

Related posts about php

Related posts about openssl