note 62526 added to function.openssl-verify
| From: | Stiv at osu1 dot php dot net | Date: | Thu, 02 Mar 2006 14:34:57 +0000 |
| Subject: | note 62526 added to function.openssl-verify | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104706@lists.php.net to get a copy of this message | ||
I've finally found a way to verify signature. Sample in the documentation doesn't work.
Code bellow DOES work :)
<?php
// $data is assumed to contain the data to be signed
// fetch certificate from file and ready it
$fp = fopen("path/file.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
// state whether signature is okay or not
// use the certificate, not the public key
$ok = openssl_verify($data, $signature, $cert);
if ($ok == 1) {
echo "good";
} elseif ($ok == 0) {
echo "bad";
} else {
echo "ugly, error checking signature";
}
?>
----
Server IP: 195.136.184.34
Probable Submitter: 213.158.197.36
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.openssl-verify.php
Edit -- http://master.php.net/note/edit/62526
Del: integrated -- http://master.php.net/note/delete/62526/integrated
Del: useless -- http://master.php.net/note/delete/62526/useless
Del: bad code -- http://master.php.net/note/delete/62526/bad+code
Del: spam -- http://master.php.net/note/delete/62526/spam
Del: non-english -- http://master.php.net/note/delete/62526/non-english
Del: in docs -- http://master.php.net/note/delete/62526/in+docs
Del: other reasons-- http://master.php.net/note/delete/62526
Reject -- http://master.php.net/note/reject/62526
Search -- http://master.php.net/manage/user-notes.php