NYCPHP Meetup

NYPHP.org

[nycphp-talk] Working with openssl

Aaron Fischer agfische at email.smith.edu
Thu Aug 17 13:20:23 EDT 2006


>>
>>OpenSSL Demo
>>http://www.smith.edu/admission/openSSL/openSSLdemo.php
>>Form testing page (passphrase is 'Encryption is fun for everyone')
>>http://www.smith.edu/admission/openSSL/openSSLtest.php
>>
>>Here is the actual code:
>>OpenSSL class
>>http://www.smith.edu/admission/openSSL/openSSLCode.php
>>Demo code
>>http://www.smith.edu/admission/openSSL/openSSLdemoCode.php
>>Form page for testing
>>http://www.smith.edu/admission/openSSL/openSSLtestCode.php
>>
csnyder wrote:
> Hi Aaron --
> 
> Nothing jumps out immediately, but to help debug the problem you
> should probably try with an unecrypted private key at first.
> openssl_get_privatekey() returns that invalid key error if it can't
> decypt the key for some reason.
> 


Hi Chris,

I removed passphrase from the demo class calls and the test form.  Upon 
testing it produced the same error:

Warning: openssl_private_decrypt() [function.openssl-private-decrypt]: 
key parameter is not a valid private key in 
/home/a/adm1a/openSSL/openSSL.php on line 119

Warning: openssl_free_key() expects parameter 1 to be resource, null 
given in /home/a/adm1a/openSSL/openSSL.php on line 122
Testing OpenSSL

It doesn't like my key, I'm not sure why.  This time around I ran the 
key and encrypted text through a text editor before entering in the form 
to make sure there weren't any invisible characters it was picking up. 
Hmmmm.

-Aaron



More information about the talk mailing list