note 121979 added to function.openssl-x509-check-private-key
| From: | tomsie at toms dot ie | Date: | Tue, 05 Dec 2017 13:51:10 +0000 |
| Subject: | note 121979 added to function.openssl-x509-check-private-key | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209314@lists.php.net to get a copy of this message | ||
This function DOES return TRUE if the key has a passphrase, you just need to set up the data in such
a way that the function can understand it. It is not documented here.
This error message led me to the solution:
PHP Warning: openssl_x509_check_private_key(): key array must be of the form array(0 => key,
1 => phrase)
So this works:
$certFile = file_get_contents('cert.crt');
$keyFile = file_get_contents('cert.key');
$keyPassphrase = "password1234";
$keyCheckData = array(0=>$keyFile,1=>$keyPassphrase);
$result = openssl_x509_check_private_key($certFile,$keyCheckData);
----
Server IP: 208.43.231.9
Probable Submitter: 150.237.170.34
----
Manual Page -- http://php.net/manual/en/function.openssl-x509-check-private-key.php
Edit -- https://master.php.net/note/edit/121979
Del: integrated -- https://master.php.net/note/delete/121979/integrated
Del: useless -- https://master.php.net/note/delete/121979/useless
Del: bad code -- https://master.php.net/note/delete/121979/bad+code
Del: spam -- https://master.php.net/note/delete/121979/spam
Del: non-english -- https://master.php.net/note/delete/121979/non-english
Del: in docs -- https://master.php.net/note/delete/121979/in+docs
Del: other reasons-- https://master.php.net/note/delete/121979
Reject -- https://master.php.net/note/reject/121979
Search -- https://master.php.net/manage/user-notes.php