Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey PHP Method

getPublicKey() public method

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
return Mdanter\Ecc\Crypto\Key\PublicKeyInterface
    public function getPublicKey(Key $key) : PublicKeyInterface
    {
        return $this->publicKeySerializer->parse($this->getKeyContent($key, 'PUBLIC KEY'));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @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());
 }
All Usage Examples Of Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey