src/BYUJWT.php
public function getPublicKey()
    {
        $cached = $this->getCache('publicKey');
        if (!empty($cached)) {
            return $cached;
        }

        $wellKnown = $this->getWellKnown();
        if (empty($wellKnown->jwks_uri)) {
            return null;
        }

        try {
            $response = $this->client->get($wellKnown->jwks_uri);
        } catch (RequestException $e) {
            $this->lastException = $e;
            return null;
        }

        $jwks = json_decode($response->getBody());
        if (empty($jwks->keys[0]->x5c[0])) {
            return null;
        }

        $X509 = new X509();
        if (!$X509->loadX509($jwks->keys[0]->x5c[0])) {
            return null;
        }

        $key = (string)$X509->getPublicKey();

        $this->setCache('publicKey', $key);

        return $key;
    }
public function getPublicKey()
    {
        $cached = $this->getCache('publicKey');
        if (!empty($cached)) {
            return $cached;
        }

        $wellKnown = $this->getWellKnown();
        if (empty($wellKnown->jwks_uri)) {
            return null;
        }

        try {
            $response = $this->client->get($wellKnown->jwks_uri);
        } catch (RequestException $e) {
            $this->lastException = $e;
            return null;
        }

        $jwks = json_decode($response->getBody());
        if (empty($jwks->keys[0]->x5c[0])) {
            return null;
        }

        $X509 = new X509();
        if (!$X509->loadX509($jwks->keys[0]->x5c[0])) {
            return null;
        }

        $key = (string)$X509->getPublicKey();

        $this->setCache('publicKey', $key);

        return $key;
    }
public function getPublicKey ( ) { $ cached = $ this -> getCache ( 'publicKey' ) ; if ( ! empty ( $ cached ) ) { return $ cached ; } $ wellKnown = $ this -> getWellKnown ( ) ; if ( empty ( $ wellKnown -> jwks_uri ) ) { return null ; } try { $ response = $ this -> client -> get ( $ wellKnown -> jwks_uri ) ; } catch ( RequestException $ e ) { $ this -> lastException = $ e ; return null ; } $ jwks = json_decode ( $ response -> getBody ( ) ) ; if ( empty ( $ jwks -> keys [ 0 ] -> x5c [ 0 ] ) ) { return null ; } $ X509 = new X509 ( ) ; if ( ! $ X509 -> loadX509 ( $ jwks -> keys [ 0 ] -> x5c [ 0 ] ) ) { return null ; } $ key = ( string ) $ X509 -> getPublicKey ( ) ; $ this -> setCache ( 'publicKey' , $ key ) ; return $ key ; }
Get the public key of the current well-known URL

@return string
Get the public key of the current well - known URL