public static function getCA($person) { if (!isset(CAHandler::$ca)) { if (Config::get_config('cert_product') == PRD_PERSONAL) { /* if no NREN object is set, we can not know anything about the days */ if (!is_object($person->getNREN())) { $days = min(ConfusaConstants::$CAPI_VALID_PERSONAL); } else { $days = $person->getNREN()->getCertValidity(); } } else { if (Config::get_config('cert_product') == PRD_ESCIENCE) { $days = ConfusaConstants::$CAPI_VALID_ESCIENCE; } else { throw new ConfusaGenException("Confusa's configured product-mode is " . "illegal! Must be one of: PRD_ESCIENCE, " . "PRD_PERSONAL. Please contact an IT " . "administrator about that!"); } } switch ((int) Config::get_config('ca_mode')) { case CA_STANDALONE: require_once 'CA_Standalone.php'; CAHandler::$ca = new CA_Standalone($person, $days); break; case CA_COMODO: require_once 'CA_Comodo.php'; if (Config::get_config('capi_test') == TRUE) { $days = ConfusaConstants::$CAPI_TEST_VALID_DAYS; } CAHandler::$ca = new CA_Comodo($person, $days); break; default: /* This is going to produce a *lot* of errors, * but it should also catch the attention of * the operators. */ Logger::log_event(LOG_ALERT, "Tried to instantiate CA " . Config::get_config('ca_mode') . " but this is unknow. Config-file has errors. Check the ca_mode."); return null; } } return CAHandler::$ca; }