Maybe this is a duplicate question and asked in this or this but this problem seems specific.
I want to connect to a bank internet payment system that uses ssl certificates but I face this error :
Warning: openssl_pkcs7_sign(): error getting private key in /home/zarsamco/public_html/eghtesad/ipg/enpayment.php on line 52
and this is the part of my code that uses certificate file (on wamp local):
openssl_pkcs7_sign(realpath("msg.txt"), realpath("signed.txt"), "file://D:/wamp/www/zarsam/eghtesad/certs/ZarsamHonar.pem",
array ("file://D:/wamp/www/zarsam/eghtesad/certs/ZarsamHonar.pem", "secretPass"),
array (), PKCS7_NOSIGS
);
it works fine in wamp on local (window 8) because the address of ZarsamHonar.pem is absolute. However this code does not work on remote server(Linux) because i think that this way of addresses is particular for windows.
I tried many Addressing methods found online and the linked SO questions.
for example I try this code (enpayment.php page):
$prepend = "file://";
openssl_pkcs7_sign(realpath(dirname(__FILE__)) . "../msg.txt",
realpath(dirname(__FILE__)) . "../signed.txt",
$prepend . realpath(dirname(__FILE__)) ."/certs/ZarsamHonar.pem",
array($prepend . realpath(dirname(__FILE__)) ."/certs/ZarsamHonar.pem", "secretPass"),array(), PKCS7_NOSIGS);
But it did not work out either.
this is a screenshot of related files structure and location of ZarsamHonar.pem , msg.txt and signed.txt files:
can any one help me?