コード例 #1
0
ファイル: OpenSSLCrypto.php プロジェクト: sop/crypto-util
 /**
  *
  * @see \CryptoUtil\Crypto\Crypto::verify()
  */
 public function verify($data, Signature $signature, PublicKeyInfo $pubkey_info, SignatureAlgorithmIdentifier $algo)
 {
     $this->_checkSignatureAlgoAndKey($algo, $pubkey_info->algorithmIdentifier());
     $result = openssl_verify($data, $signature->octets(), $pubkey_info->toPEM(), $this->_algoToDigest($algo));
     if (-1 == $result) {
         throw new \RuntimeException("openssl_verify() failed: " . $this->_getLastError());
     }
     return 1 == $result ? true : false;
 }