Esempio n. 1
0
 public function pre_process($person)
 {
     parent::pre_process($person);
     $this->tpl->assign('extraScripts', array('js/jquery-1.6.1.min.js'));
     $this->tpl->assign('rawScript', file_get_contents('../include/rawToggleExpand.js'));
     if (isset($_GET['status_poll'])) {
         $order_number = Input::sanitizeCertKey($_GET['status_poll']);
         /* assign the order_number again */
         $this->tpl->assign('order_number', $order_number);
         $this->tpl->assign('status_poll', true);
         $anticsrf = "anticsrf=" . Input::sanitizeAntiCSRFToken($_GET['anticsrf']);
         $this->tpl->assign('ganticsrf', $anticsrf);
         if ($this->ca->pollCertStatus($order_number)) {
             /* redirect to certificate download area */
             CS::setSessionKey("browserCert", $order_number);
             header("Location: download_certificate.php");
         }
     }
     /* when the key has been generated in the browser and the
      * resulting CSR has been uploaded to the server, we end up
      * here.
      */
     if (isset($_POST['browserRequest'])) {
         $ua = Output::getUserAgent();
         switch ($ua) {
             case "opera":
             case "safari":
             case "mozilla":
             case "chrome":
                 $csr = new CSR_SPKAC(trim(Input::sanitizeBase64($_POST['browserRequest'])));
                 break;
             case "msie_pre_vista":
             case "msie_post_vista":
                 $csrContent = CSR::$PEM_PREFIX . "\n" . trim(Input::sanitizeBase64($_POST['browserRequest'])) . "\n" . CSR::$PEM_SUFFIX;
                 $csr = new CSR_PKCS10($csrContent);
                 break;
         }
         if (!empty($csr) && $csr->isValid()) {
             try {
                 $order_number = $this->signCSR($csr);
                 $this->tpl->assign('order_number', $order_number);
             } catch (KeySignException $kse) {
                 Framework::error_output($this->translateTag('l10n_sign_error', 'processcsr') . "<br /><br />" . $kse->getMessage());
                 Logger::logEvent(LOG_WARNING, "CP_Browser_CSR", "pre_process()", "Could not sign CSR because of " . $kse->getMessage() . " User: "******"CP_Browser_CSR", "pre_process()", "Received browser-CSR that could not be parsed!" . " User: " . $this->person->getEPPN(), __LINE__);
         }
     }
 }