Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Weird Paypal SSL problem


camchutka

Recommended Posts

I'm trying to set up encrypted payments with paypal IPN.

 

Did all steps:

 

1) created private key

2) created my certificate

3) downloaded paypal's certificate

3) uploaded my certificate to paypal, got my certificate ID

 

When testing this, I get these 2 errors (on the last screen before confirmation):

 

1) Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting private key in /home/myuserid/public_html/mystore/includes/modules/payment/paypal_ipn.php on line 433

 

2) Warning: file_get_contents(/home/myuserid/public_html/tmp/259465-15-signed.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/myuserid/public_html/shop2/includes/modules/payment/paypal_ipn.php on line 437

 

The second error is not important - it results from the first error. If the first error is fixed, this second one goes away.

 

The line in question (433) for the first error is:

 

openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);

 

This call has 6 parameters:

 

1) Input file (MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt'). Debugging (using 'echo' statements and viewing the resulting source) this translates to: /home/myuserid/public_html/tmp/278281-15-data.txt. Using the same debugging technique and echoing 'file_get_contents()' against this filename, I see the contents of my test order. I use the same debugging technique with the other parameters ...

 

2) Ouput file (MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt'). This translates to: /home/myuserid/public_html/tmp/278281-15-signed.txt. I don't echo the contents of this file, as it has yet to be created. This call, if successful, would have created it.

 

3) Public key (file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY)). This shows as:

 

-----BEGIN CERTIFICATE-----

.

. my public key data

.

-----END CERTIFICATE-----

 

4) Private key (file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY)). This shows as

 

-----BEGIN RSA PRIVATE KEY-----

Proc-Type: 4,ENCRYPTED

DEK-Info: DES-EDE3-CBC ... etc

 

.

. My private key

.

-----END RSA PRIVATE KEY-----

 

5) Headers (array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID)). This displays as:

 

Key: From; Value: <my paypal email address>

 

6 Flags (PKCS7_BINARY). This displays as 128 and I believe sets the mode of the output file.

 

Clearly, since I am able to echo the contents of all files in this call, all required files exist, are accessible and have valid(?) data. So what is the 'error getting private key'. It was created like this:

 

openssl genrsa -des3 -out myprivatekey.pem 2048

 

Any ideas why I get this weird error?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...