コード例 #1
0
ファイル: ECDSA.php プロジェクト: spomky-labs/jose
 /**
  * @param \Jose\Object\JWKInterface $key
  * @param string                    $data
  * @param string                    $R
  * @param string                    $S
  *
  * @return bool
  */
 private function verifyOpenSSLSignature(JWKInterface $key, $data, $R, $S)
 {
     $pem = ECKey::toPublic(new ECKey($key))->toPEM();
     $oid_sequence = new Sequence();
     $oid_sequence->addChildren([new Integer(gmp_strval($this->convertHexToGmp($R), 10)), new Integer(gmp_strval($this->convertHexToGmp($S), 10))]);
     return 1 === openssl_verify($data, $oid_sequence->getBinary(), $pem, $this->getHashAlgorithm());
 }