note 88645 added to function.openssl-pkey-get-private

From: Date: Mon, 02 Feb 2009 06:13:22 +0000
Subject: note 88645 added to function.openssl-pkey-get-private
Groups: php.notes 
Request: Send a blank email to php-notes+get-150089@lists.php.net to get a copy of this message
I also spent hours when trying to find the reason of error: "error getting private key". Sometimes this error appeared, sometimes not. My solution is using the realpath() for every parameter of openssl_pkcs7_sign. In my case the code looks like: <? $Certif_path = 'certificate/mycertificate.pem'; $clearfile = "certificate/random_name"; $encfile = $clearfile . ".enc"; $clearfile = $clearfile . ".txt"; // ---- // -- fill $clearfile with the mail to be signed ... // ---- openssl_pkcs7_sign(realpath($clearfile), realpath('.').'/'.$encfile, // because $encfile does not exist yet we cannot use realpath($encfile); 'file://'.realpath($Certif_path), array('file://'.realpath($Certif_path), PUBLIC_KEY), array("To" => TO_EMAIL, "From" => FROM_EMAIL, "Subject" => ""), PKCS7_DETACHED)); ?> ---- Server IP: 66.207.199.35 Probable Submitter: 99.224.113.251 ---- Manual Page -- http://www.php.net/manual/en/function.openssl-pkey-get-private.php Edit -- https://master.php.net/note/edit/88645 Del: integrated -- https://master.php.net/note/delete/88645/integrated Del: useless -- https://master.php.net/note/delete/88645/useless Del: bad code -- https://master.php.net/note/delete/88645/bad+code Del: spam -- https://master.php.net/note/delete/88645/spam Del: non-english -- https://master.php.net/note/delete/88645/non-english Del: in docs -- https://master.php.net/note/delete/88645/in+docs Del: other reasons-- https://master.php.net/note/delete/88645 Reject -- https://master.php.net/note/reject/88645 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150089) next »