function getPublicKey()
    {
        if (isset($this->publicKey)) {
            return $this->publicKey;
        }

        if (isset($this->currentCert) && is_array($this->currentCert)) {
            foreach (array('tbsCertificate/subjectPublicKeyInfo', 'certificationRequestInfo/subjectPKInfo') as $path) {
                $keyinfo = $this->_subArray($this->currentCert, $path);
                if (!empty($keyinfo)) {
                    break;
                }
            }
        }
        if (empty($keyinfo)) {
            return false;
        }

        $key = $keyinfo['subjectPublicKey'];

        switch ($keyinfo['algorithm']['algorithm']) {
            case 'rsaEncryption':
                $publicKey = new RSA();
                $publicKey->loadKey($key);
                $publicKey->setPublicKey();
                break;
            default:
                return false;
        }

        return $publicKey;
    }
function getPublicKey()
    {
        if (isset($this->publicKey)) {
            return $this->publicKey;
        }

        if (isset($this->currentCert) && is_array($this->currentCert)) {
            foreach (array('tbsCertificate/subjectPublicKeyInfo', 'certificationRequestInfo/subjectPKInfo') as $path) {
                $keyinfo = $this->_subArray($this->currentCert, $path);
                if (!empty($keyinfo)) {
                    break;
                }
            }
        }
        if (empty($keyinfo)) {
            return false;
        }

        $key = $keyinfo['subjectPublicKey'];

        switch ($keyinfo['algorithm']['algorithm']) {
            case 'rsaEncryption':
                $publicKey = new RSA();
                $publicKey->loadKey($key);
                $publicKey->setPublicKey();
                break;
            default:
                return false;
        }

        return $publicKey;
    }
function getPublicKey ( ) { if ( isset ( $ this -> publicKey ) ) { return $ this -> publicKey ; } if ( isset ( $ this -> currentCert ) && is_array ( $ this -> currentCert ) ) { foreach ( array ( 'tbsCertificate/subjectPublicKeyInfo' , 'certificationRequestInfo/subjectPKInfo' ) as $ path ) { $ keyinfo = $ this -> _subArray ( $ this -> currentCert , $ path ) ; if ( ! empty ( $ keyinfo ) ) { break ; } } } if ( empty ( $ keyinfo ) ) { return false ; } $ key = $ keyinfo [ 'subjectPublicKey' ] ; switch ( $ keyinfo [ 'algorithm' ] [ 'algorithm' ] ) { case 'rsaEncryption' : $ publicKey = new RSA ( ) ; $ publicKey -> loadKey ( $ key ) ; $ publicKey -> setPublicKey ( ) ; break ; default : return false ; } return $ publicKey ; }
Gets the public key

Returns a \phpseclib\Crypt\RSA object or a false.

@access public
@return mixed
Gets the public key