std::unordered_map<std::string, std::shared_ptr<CAConfig>> CAs;
std::string sqlHost, sqlUser, sqlPass, sqlDB;
std::string serialPath;
+std::string crlPrefix;
+std::string crtPrefix;
+std::string ocspPath;
std::shared_ptr<std::unordered_map<std::string, std::string>> parseConf( std::string path ) {
auto map = std::make_shared<std::unordered_map<std::string, std::string>>();
if( !config.is_open() ) {
logger::notef( "Where is \"%s\"?", path );
- throw "Config missing";
+ throw std::runtime_error( "Config missing" );
}
std::string line1;
int parseProfiles() {
CAs = std::unordered_map<std::string, std::shared_ptr<CAConfig>>();
- DIR* dp;
- struct dirent* ep;
+ DIR *dp;
+ struct dirent *ep;
dp = opendir( "profiles" );
if( dp == NULL ) {
prof.id = std::stoi( id );
prof.eku = map->at( "eku" );
prof.ku = map->at( "ku" );
+ {
+ std::string include = map->at( "include" );
+ size_t pos = 0;
+ size_t end = 0;
+ std::unordered_set<std::string> include_set;
+
+ while( ( end = include.find( ",", pos ) ) != std::string::npos ) {
+ include_set.emplace( include.substr( pos, end - pos ) );
+ pos = end + 1;
+ }
+
+ include_set.emplace( include.substr( pos ) );
+ prof.include = include_set;
+ }
prof.maxValidity = std::stoi( map->at( "days" ) ) * /* DAYS */24 * 60 * 60;
- std::string cas = map->at( "ca" );
- DIR* dir;
- struct dirent* ent;
+ DIR *dir;
+ struct dirent *ent;
+
+ if( profileName == "0100-ocsp" ) {
+ //This profile does not have a specific CA. The concrete CA has to be set in each request.
+ } else if( ( dir = opendir( "ca" ) ) != NULL ) {
+ std::string cas = map->at( "ca" );
+ std::string toFind = cas + "_";
- if( ( dir = opendir( "ca" ) ) != NULL ) {
while( ( ent = readdir( dir ) ) != NULL ) {
std::string caName = std::string( ent->d_name );
- if( caName.find( cas ) != 0 ) {
+ if( caName.find( toFind ) != 0 ) {
continue;
}
closedir( dir );
} else {
- throw "Directory with CAConfigs not found";
+ throw std::runtime_error( "Directory with CAConfigs not found" );
}
profiles.emplace( profileName, prof );
sqlPass = masterConf->at( "sql.password" );
sqlDB = masterConf->at( "sql.database" );
serialPath = masterConf->at( "serialPath" );
+ crlPrefix = masterConf->at( "crlPrefix" );
+ crtPrefix = masterConf->at( "crtPrefix" );
+
+ auto ocspPathEntry = masterConf->find( "ocsp.path" );
+
+ if( ocspPathEntry == masterConf->end() ) {
+ ocspPath = "";
+ } else {
+ ocspPath = ocspPathEntry->second;
+ }
if( keyDir == "" ) {
logger::error( "Missing config property key.directory" );