Parses a public key from the given PEM content
public getPublicKey ( Lcobucci\JWT\Signer\Key $key ) : Mdanter\Ecc\Crypto\Key\PublicKeyInterface | ||
$key | Lcobucci\JWT\Signer\Key | |
Результат | Mdanter\Ecc\Crypto\Key\PublicKeyInterface |
/** * @test * * @expectedException \InvalidArgumentException * * @uses \Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct * @uses \Lcobucci\JWT\Signer\Key * * @covers \Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey * @covers \Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent */ public function getPublicKeyShouldRaiseExceptionWhenAWrongKeyWasGiven() { $this->publicKeySerializer->expects($this->never())->method('parse'); $parser = new KeyParser($this->privateKeySerializer, $this->publicKeySerializer); $parser->getPublicKey($this->getPrivateKey()); }
/** * {@inheritdoc} */ public function doVerify(string $expected, string $payload, Key $key) : bool { return $this->signer->verify($this->parser->getPublicKey($key), $this->extractSignature($expected), $this->createSigningHash($payload)); }
/** * {@inheritdoc} */ public function doVerify(string $expected, string $payload, Key $key) : bool { return $this->adapter->verifyHash($expected, $this->keyParser->getPublicKey($key), $this->adapter->createSigningHash($payload, $this->getAlgorithm()), $this->getAlgorithm()); }