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(); } } }
/** * Setup test environment * */ public function setUp() { if (!extension_loaded('openssl')) { throw new PrerequisitesNotMetError(PREREQUISITE_LIBRARYMISSING, $cause = NULL, array('openssl')); } if ($this->cert && $this->publickey && $this->privatekey) { return; } // Generate private & public key, using a self-signed certificate $keypair = KeyPair::generate(); $privatekey = $keypair->getPrivateKey(); $csr = new CSR(new Principal(array('C' => 'DE', 'ST' => 'Baden-Württemberg', 'L' => 'Karlsruhe', 'O' => 'XP', 'OU' => 'XP Team', 'CN' => 'XP Unittest', 'EMAIL' => '*****@*****.**')), $keypair); $cert = $csr->sign($keypair); $publickey = $cert->getPublicKey(); $this->cert = $cert; $this->publickey = $publickey; $this->privatekey = $privatekey; }
function applicationStartHandler($params) { $routes =& CSR::get('routes'); $routes['/develop/'] = MODULES_DIR . 'csr/develop/public/index.php'; // Create controller DevelopTools::setContent(array('title' => 'Generate Controller', 'message' => 'フォームからコントローラーとビューの作成を行います。', 'contents' => MODULES_DIR . 'csr/develop/public/generate/index.html', 'path' => 'generate')); $contents =& DevelopTools::contents(); foreach ($contents as $content) { $routes['/develop/' . $content['path']] = $content['contents']; } // routesに追加 $routes['/develop/(.*)'] = MODULES_DIR . 'csr/develop/public/$1'; }
function __construct($content) { parent::__construct($content); $this->encoding = $this->getEncoding($content); switch ($this->encoding) { case parent::$KEY_ENCODING_PEM: $this->csr_pem = $this->content; break; case parent::$KEY_ENCODING_DER: $this->csr_pem = $this->der2pem($this->content); $this->csr_der = $this->content; break; default: throw new CryptoElementException("Internal problem, encoding set to non-recognizable format."); } }
<p>URI Dispatchに失敗しました。</p> <p>意図せずこの画面が表示された場合、このアプリケーションに登録されたURIリストの中から、リクエストURIに該当する物が存在するかどうかを確認してください。存在しない場合に、このエラーが表示されます。</p> <p> あるのに、このエラーが出る場合は、多分バグです。開発者に連絡してください。 http://dev.shamoo.org/ </p> <?php $dispatcher = CSR::get('dispatcher'); $routes = $dispatcher->getRoutes(); $request = $dispatcher->request; ?> <h2>Routes</h2> <ul> <?php foreach ($routes as $uri => $route) { ?> <li><?php echo $uri; ?> => <?php echo $route; ?> </li> <?php } ?> </ul> <h2>RequestURI</h2> <?php echo $request; ?> <h2>解決策</h2>
<?php /** * index.php * @package csr */ /** * require CSR classes */ require 'csr.php'; if (CSR_DEVELOP_MODE) { CSR::import('csr.develop.DevelopTools'); } CSR::execute(array('/' => 'index/index'));
function mvcActionPhase() { $dispatcher =& CSR::get('dispatcher'); $parsed = $dispatcher->getParsedParams(); list($targetController, $targetAction) = explode('/', $parsed['target']); CSR::set('controllerName', $targetController); CSR::set('actionName', $targetAction); $arguments = isset($parsed['arguments']) ? $parsed['arguments'] : null; if (!($controllerClassName = CSR_Controller::loadController($targetController))) { return CSR_Controller::_missingController(); } // Private action if ($targetAction[0] === '_') { return CSR_Controller::_privateAction(); } $view =& CSR::set('view', new CSR_View()); $controller =& CSR::set('controller', new $controllerClassName()); CSR::addEvent(EVENT_BEFORE_ACTION, array(&$controller, 'beforeAction')); CSR::addEvent(EVENT_AFTER_ACTION, array(&$controller, 'afterAction')); CSR::addEvent(EVENT_BEFORE_RENDER, array(&$controller, 'beforeRender')); CSR::addEvent(EVENT_AFTER_RENDER, array(&$controller, 'afterRender')); $controller->_beforeActionResults = CSR::triggerEvent(EVENT_BEFORE_ACTION); if ($controller->_isExecutable() && !$controller->_executeAction($targetAction, $arguments)) { return CSR_Controller::_undefinedAction(); } CSR::triggerEvent(EVENT_AFTER_ACTION); }
function __construct($content) { parent::__construct($content); $this->spkac_der = $content; }
/** * 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); }
/** * insertIntoDB() insert a CSR into the database (csr_cache) * * @param CSR|String $csr the CSR to store in the database * @param Person $person the owner * @return Boolean True if insertion went ok * @access public */ static function insertIntoDB($csr, $person) { if (is_string($csr)) { $csr = new CSR($csr); if ($csr->isVali()) { return $csr->storeDB(); } } return false; }