SAML2\SignedElementHelper::getValidatingCertificates PHP Method

getValidatingCertificates() public method

Retrieve certificates that sign this element.
public getValidatingCertificates ( ) : array
return array Array with certificates.
    public function getValidatingCertificates()
    {
        $ret = array();
        foreach ($this->certificates as $cert) {
            /* Construct a PEM formatted certificate */
            $pemCert = "-----BEGIN CERTIFICATE-----\n" . chunk_split($cert, 64) . "-----END CERTIFICATE-----\n";
            /* Extract the public key from the certificate for validation. */
            $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'public'));
            $key->loadKey($pemCert);
            try {
                /* Check the signature. */
                if ($this->validate($key)) {
                    $ret[] = $cert;
                }
            } catch (\Exception $e) {
                /* This certificate does not sign this element. */
            }
        }
        return $ret;
    }