/** * * @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; }
/** * Get ASN.1 structure. * * @return Sequence */ public function toASN1() { return new Sequence($this->_acinfo->toASN1(), $this->_signatureAlgorithm->toASN1(), $this->_signatureValue->toBitString()); }
/** * Generate ASN.1 structure. * * @return Sequence */ public function toASN1() { return new Sequence($this->_certificationRequestInfo->toASN1(), $this->_signatureAlgorithm->toASN1(), $this->_signature->toBitString()); }