我有一份签名的PDF文件。它是使用TCPDF签署的。现在我想验证它。这是我的解决方案:
我的问题是在最后一步,当我将D1与D2进行比较时,它们并不相等。我不知道为什么。 谢谢你的帮助。
答案 0 :(得分:1)
You should try based on following example
<?php
// $data and $signature are assumed to contain the data and the signature
// fetch public key from certificate and ready it
$pubkeyid = openssl_pkey_get_public("file://src/openssl-0.9.6/demos/sign/cert.pem");
// state whether signature is okay or not
$ok = openssl_verify($data, $signature, $pubkeyid);
if ($ok == 1) {
echo "good";
} elseif ($ok == 0) {
echo "bad";
} else {
echo "ugly, error checking signature";
}
// free the key from memory
openssl_free_key($pubkeyid);
?>
more Examples ad explanation
http://www.php.net/manual/en/function.openssl-verify.php