Rev

Rev 3349 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | Bug Tracker

Rev 3349 Rev 3350
Line 46... Line 46...
46
  }
46
  }
47
47
48
  return 0;
48
  return 0;
49
} // End of method build_path
49
} // End of method build_path
50
50
51
int certificates_loader::load_certificates(std::map<std::string, std::unique_ptr<security_db_record> >& p_certificates, /*std::map<OCTETSTRING, std::string>*/std::map<std::vector<unsigned char>, std::string>& p_hashed_id8s) {
51
int certificates_loader::load_certificates(std::map<std::string, std::unique_ptr<security_db_record> >& p_certificates, std::map<OCTETSTRING/*std::vector<unsigned char>*/, std::string, security_cache_comp>& p_hashed_id8s) {
52
  loggers::get_instance().log(">>> certificates_loader::load_certificates");
52
  loggers::get_instance().log(">>> certificates_loader::load_certificates");
53
53
54
  // Sanity check
54
  // Sanity check
55
  if (_is_cache_initialized) {
55
  if (_is_cache_initialized) {
56
    return 0;
56
    return 0;
Line 117... Line 117...
117
  }
117
  }
118
 
118
 
119
  return 0;
119
  return 0;
120
} // End of method retrieve_certificates_list
120
} // End of method retrieve_certificates_list
121
121
122
int certificates_loader::build_certificates_cache(std::set<std::experimental::filesystem::path>& p_files, std::map<std::string, std::unique_ptr<security_db_record> >& p_certificates, /*std::map<OCTETSTRING, std::string>*/std::map<std::vector<unsigned char>, std::string>& p_hashed_id8s) {
122
int certificates_loader::build_certificates_cache(std::set<std::experimental::filesystem::path>& p_files, std::map<std::string, std::unique_ptr<security_db_record> >& p_certificates, std::map<OCTETSTRING/*std::vector<unsigned char>*/, std::string, security_cache_comp>& p_hashed_id8s) {
123
  loggers::get_instance().log(">>> certificates_loader::build_certificates_cache");
123
  loggers::get_instance().log(">>> certificates_loader::build_certificates_cache");
124
124
125
  std::set<std::experimental::filesystem::path>::const_iterator it = p_files.cbegin();
125
  std::set<std::experimental::filesystem::path>::const_iterator it = p_files.cbegin();
126
  std::pair<std::map<std::string, std::unique_ptr<security_db_record> >::iterator, bool> result;
126
  std::pair<std::map<std::string, std::unique_ptr<security_db_record> >::iterator, bool> result;
127
  do {
127
  do {
Line 297... Line 297...
297
        delete p;
297
        delete p;
298
        return -1;
298
        return -1;
299
      }
299
      }
300
      loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: add key: ", result.first->second.get()->hashed_id());
300
      loggers::get_instance().log_msg("certificates_loader::build_certificates_cache: add key: ", result.first->second.get()->hashed_id());
301
      loggers::get_instance().log("certificates_loader::build_certificates_cache: for : %s", result.first->first.c_str());
301
      loggers::get_instance().log("certificates_loader::build_certificates_cache: for : %s", result.first->first.c_str());
302
      //p_hashed_id8s.insert(std::pair<OCTETSTRING, std::string>(result.first->second.get()->hashed_id(), result.first->first));
302
      p_hashed_id8s.insert(std::pair<OCTETSTRING, std::string>(result.first->second.get()->hashed_id(), result.first->first));
303
      std::vector<unsigned char> v(static_cast<const unsigned char*>(result.first->second.get()->hashed_id()), result.first->second.get()->hashed_id().lengthof() + static_cast<const unsigned char*>(result.first->second.get()->hashed_id()));
303
      /*std::vector<unsigned char> v(static_cast<const unsigned char*>(result.first->second.get()->hashed_id()), result.first->second.get()->hashed_id().lengthof() + static_cast<const unsigned char*>(result.first->second.get()->hashed_id()));
304
      loggers::get_instance().log_to_hexa("security_cache::store_certificate: Converted hashed_id8: ", v.data(), v.size());
304
      loggers::get_instance().log_to_hexa("security_cache::store_certificate: Converted hashed_id8: ", v.data(), v.size());
305
      p_hashed_id8s.insert(std::pair<std::vector<unsigned char>, std::string>(v, result.first->first));
305
      p_hashed_id8s.insert(std::pair<std::vector<unsigned char>, std::string>(v, result.first->first));*/
306
    }
306
    }
307
    // Reset pointer
307
    // Reset pointer
308
    it = p_files.cbegin();
308
    it = p_files.cbegin();
309
  } while (it != p_files.cend());
309
  } while (it != p_files.cend());
310
 
310