function getChain()
    {
        $chain = array($this->currentCert);

        if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
            return false;
        }
        if (empty($this->CAs)) {
            return $chain;
        }
        while (true) {
            $currentCert = $chain[count($chain) - 1];
            for ($i = 0; $i < count($this->CAs); $i++) {
                $ca = $this->CAs[$i];
                if ($currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']) {
                    $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier', $currentCert);
                    $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca);
                    switch (true) {
                        case !is_array($authorityKey):
                        case is_array($authorityKey) && isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID:
                            if ($currentCert === $ca) {
                                break 3;
                            }
                            $chain[] = $ca;
                            break 2;
                    }
                }
            }
            if ($i == count($this->CAs)) {
                break;
            }
        }
        foreach ($chain as $key => $value) {
            $chain[$key] = new File_X509();
            $chain[$key]->loadX509($value);
        }
        return $chain;
    }
function getChain()
    {
        $chain = array($this->currentCert);

        if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
            return false;
        }
        if (empty($this->CAs)) {
            return $chain;
        }
        while (true) {
            $currentCert = $chain[count($chain) - 1];
            for ($i = 0; $i < count($this->CAs); $i++) {
                $ca = $this->CAs[$i];
                if ($currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']) {
                    $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier', $currentCert);
                    $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca);
                    switch (true) {
                        case !is_array($authorityKey):
                        case is_array($authorityKey) && isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID:
                            if ($currentCert === $ca) {
                                break 3;
                            }
                            $chain[] = $ca;
                            break 2;
                    }
                }
            }
            if ($i == count($this->CAs)) {
                break;
            }
        }
        foreach ($chain as $key => $value) {
            $chain[$key] = new File_X509();
            $chain[$key]->loadX509($value);
        }
        return $chain;
    }
function getChain ( ) { $ chain = array ( $ this -> currentCert ) ; if ( ! is_array ( $ this -> currentCert ) || ! isset ( $ this -> currentCert [ 'tbsCertificate' ] ) ) { return false ; } if ( empty ( $ this -> CAs ) ) { return $ chain ; } while ( true ) { $ currentCert = $ chain [ count ( $ chain ) - 1 ] ; for ( $ i = 0 ; $ i < count ( $ this -> CAs ) ; $ i ++ ) { $ ca = $ this -> CAs [ $ i ] ; if ( $ currentCert [ 'tbsCertificate' ] [ 'issuer' ] === $ ca [ 'tbsCertificate' ] [ 'subject' ] ) { $ authorityKey = $ this -> getExtension ( 'id-ce-authorityKeyIdentifier' , $ currentCert ) ; $ subjectKeyID = $ this -> getExtension ( 'id-ce-subjectKeyIdentifier' , $ ca ) ; switch ( true ) { case ! is_array ( $ authorityKey ) : case is_array ( $ authorityKey ) && isset ( $ authorityKey [ 'keyIdentifier' ] ) && $ authorityKey [ 'keyIdentifier' ] === $ subjectKeyID : if ( $ currentCert === $ ca ) { break 3 ; } $ chain [ ] = $ ca ; break 2 ; } } } if ( $ i == count ( $ this -> CAs ) ) { break ; } } foreach ( $ chain as $ key => $ value ) { $ chain [ $ key ] = new File_X509 ( ) ; $ chain [ $ key ] -> loadX509 ( $ value ) ; } return $ chain ; }
Get the certificate chain for the current cert

@access public
@return mixed
Get the certificate chain for the current cert