+
+ auto map = parseConf( std::string( "profiles/" ) + profileName );
+
+ profileName = profileName.substr( 0, profileName.size() - 4 );
+
+ Profile prof;
+ prof.id = std::stoi( id );
+ prof.eku = map->at( "eku" );
+ prof.ku = map->at( "ku" );
+ prof.maxValidity = std::stoi( map->at( "days" ) ) * /* DAYS */24 * 60 * 60;
+
+ std::string cas = map->at( "ca" );
+
+ DIR* dir;
+ struct dirent* ent;
+
+ if( ( dir = opendir( "ca" ) ) != NULL ) {
+ while( ( ent = readdir( dir ) ) != NULL ) {
+ std::string caName = std::string( ent->d_name );
+
+ if( caName.find( cas ) != 0 ) {
+ continue;
+ }
+
+ if( CAs.find( caName ) == CAs.end() ) {
+ auto ca = std::make_shared<CAConfig>( caName );
+ CAs.emplace( caName, ca );
+ }
+
+ prof.ca.push_back( CAs.at( caName ) );
+ logger::note( "Adding CA: ", caName );
+ }
+
+ closedir( dir );
+ } else {
+ throw std::runtime_error("Directory with CAConfigs not found");
+ }
+
+ profiles.emplace( profileName, prof );
+ logger::notef( "Profile: \"%s\" up and running.", profileName );