コード例 #1
0
ファイル: receive_csr.php プロジェクト: henrikau/confusa
 function pre_process($person)
 {
     parent::pre_process($person);
     /* can be received when pressing "Back" on the CSR-signing overview */
     if (isset($_POST['deleteCSR'])) {
         $authToken = Input::sanitizeCertKey($_POST['deleteCSR']);
         CSR::deleteFromDB($person, $authToken);
         return;
     }
     $this->tpl->assign('extraScripts', array('js/jquery-1.6.1.min.js'));
     $this->tpl->assign('rawScript', file_get_contents('../include/rawToggleExpand.js'));
     $emailsDesiredByNREN = $this->person->getNREN()->getEnableEmail();
     $registeredPersonMails = $this->person->getNumEmails();
     /** e-mail selection was skipped */
     if (isset($_GET['skipped_email']) && $_GET['skipped_email'] == 'yes') {
         $this->tpl->assign('skippedEmail', true);
         if (($emailsDesiredByNREN == '1' || $emailsDesiredByNREN == 'm') && $registeredPersonMails == 1) {
             $this->person->regCertEmail($this->person->getEmail());
             $this->person->storeRegCertEmails();
         }
     } else {
         if (isset($_POST['subjAltName_email']) && is_array($_POST['subjAltName_email'])) {
             foreach ($_POST['subjAltName_email'] as $key => $value) {
                 Logger::logEvent(LOG_INFO, "CP_Select_Email", "pre_process()", "User " . $this->person->getEPPN() . ", registering " . "the following e-mail: " . $value);
                 $this->person->regCertEmail(Input::sanitizeText($value));
             }
             $this->person->storeRegCertEmails();
         }
     }
 }
コード例 #2
0
ファイル: upload_csr.php プロジェクト: henrikau/confusa
 /**
  * Sign the CSR with the passed authToken. If signing succeeds, the class
  * member authKey is set to the orderNumber/certHash. If not, an error is
  * displayer
  * @param $authToken pubkey hash of the CSR that is to be signed
  */
 private function signCSR($authToken)
 {
     $csr = CSR::getFromDB($this->person->getX509ValidCN(), $authToken);
     if (!isset($csr) || !$csr) {
         $errorTag = PW::create();
         Framework::error_output("[{$errorTag}] Did not find CSR with auth_token " . htmlentities($auth_token));
         $msg = "User " . $this->person->getEPPN() . " ";
         $msg .= "tried to delete CSR with auth_token " . $authToken . " but was unsuccessful";
         Logger::logEvent(LOG_NOTICE, "Process_CSR", "approveCSR({$authToken})", $msg, __LINE__, $errorTag);
         return false;
     }
     try {
         if (!isset($this->ca)) {
             Framework::error_output($this->translateTag('l10n_err_noca', 'processcsr'));
             return false;
         }
         $permission = $this->person->mayRequestCertificate();
         if ($permission->isPermissionGranted() === false) {
             Framework::error_output($this->translateTag('l10n_err_noperm1', 'processcsr') . "<br /><br />" . $permission->getFormattedReasons() . "<br />" . $this->translateTag('l10n_err_noperm2', 'processcsr'));
             return;
         }
         $this->authKey = $this->ca->signKey($csr);
     } catch (CGE_ComodoAPIException $capie) {
         Framework::error_output($this->translateTag('l10n_sign_error', 'processcsr') . htmlentities($capie));
         return false;
     } catch (ConfusaGenException $e) {
         $msg = $this->translateTag('l10n_sign_error', 'processcsr') . "<br /><br /><i>" . htmlentities($e->getMessage()) . "</i><br />";
         Framework::error_output($msg);
         return false;
     } catch (KeySigningException $kse) {
         Framework::error_output($this->translateTag('l10n_sign_error', 'processcsr') . htmlentites($kse->getMessage()));
         return false;
     }
     CSR::deleteFromDB($this->person, $authToken);
 }