예제 #1
0
 protected function _validateWithOpenSsl()
 {
     $command = new Janus_OpenSsl_Command_Verify();
     if (isset($this->_trustedRootCertificateAuthorityFile)) {
         $command->setCertificateAuthorityFile($this->_trustedRootCertificateAuthorityFile);
     }
     // Open ssl command does not return it's error output when called indirectly
     $command->enableErrorToOutputRedirection();
     $command->execute($this->_certificate->getPem());
     $results = $command->getParsedResults();
     $this->_isValid = $results['valid'];
     foreach ($results['errors'] as $openSslErrorCode => $openSslError) {
         if ($openSslErrorCode === OPENSSL_X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) {
             if ($this->_ignoreOnSelfSigned) {
                 continue;
             } elseif ($this->_warnOnSelfSigned) {
                 $this->_warnings[] = self::WARNING_PREFIX . $openSslError['description'];
                 continue;
             }
         }
         $this->_errors[] = self::ERROR_PREFIX . $openSslError['description'];
     }
 }