Compare Revisions

The credentials to download the source code are:
 Username: svnusers
 Password: svnusers

Ignore whitespace Rev 3336 → Rev 3337

/branches/STF525/ccsrc/Protocols/Security/certificates_loader.cc
125,6 → 125,7
loggers::get_instance().log(">>> certificates_loader::build_certificates_cache");
 
std::set<std::experimental::filesystem::path>::const_iterator it = p_files.cbegin();
std::pair<std::map<std::string, std::unique_ptr<security_db_record> >::iterator, bool> result;
do {
loggers::get_instance().log("certificates_loader::build_certificates_cache: Caching '%s'", it->string().c_str());
std::experimental::filesystem::path p = *it;
270,29 → 271,28
loggers::get_instance().log_to_hexa("certificates_loader::build_certificates_cache: issuer: ", issuer.data(), issuer.size());
// Create new record
p_certificates.insert(std::pair<const std::string, std::unique_ptr<security_db_record> >(key, std::unique_ptr<security_db_record>(
new security_db_record(
key,
certificate, // Certificate
decoded_certificate,
issuer, // Hashed ID fo the issuer
hashed_id, // Hashed ID
private_key, // Private key
public_key_x, // public keys X-coordinate
public_key_y, // public keys Y-coordinate
public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03)
private_enc_key, // Private enciption key
public_enc_key_x, // Public enciption key X-coordinate
public_enc_key_y, // Public enciption key Y-coordinate
public_enc_comp_key // Public compressed enciption key
))
));
std::map<std::string, std::unique_ptr<security_db_record> >::const_iterator i = p_certificates.find(key);
if (i == p_certificates.cend()) {
security_db_record* p = new security_db_record(
key,
certificate, // Certificate
decoded_certificate,
issuer, // Hashed ID fo the issuer
hashed_id, // Hashed ID
private_key, // Private key
public_key_x, // public keys X-coordinate
public_key_y, // public keys Y-coordinate
public_comp_key, // public compressed key, 33 or 49 bytes length, byte #0 indicating compressed-y-0 (0x02) or compressed-y-1 (0x03)
private_enc_key, // Private enciption key
public_enc_key_x, // Public enciption key X-coordinate
public_enc_key_y, // Public enciption key Y-coordinate
public_enc_comp_key // Public compressed enciption key
);
result = p_certificates.insert(std::pair<const std::string, std::unique_ptr<security_db_record> >(key, std::unique_ptr<security_db_record>(p)));
if (result.second == false) {
loggers::get_instance().warning("certificates_loader::build_certificates_cache: Failed to insert new record '%s'", key.c_str());
delete p;
return -1;
}
p_hashed_id8s.insert(std::pair<std::vector<unsigned char>, std::string>(i->second.get()->hashed_id(), i->first));
p_hashed_id8s.insert(std::pair<std::vector<unsigned char>, std::string>(result.first->second.get()->hashed_id(), result.first->first));
// Reset pointer
it = p_files.cbegin();
/branches/STF525/ccsrc/Protocols/Security/security_cache.cc
220,19 → 220,19
fill_vector(cert, p_cert);
fill_vector(private_key, p_private_key);
 
fill_vector(public_key_x, p_public_key_x);
fill_vector(public_key_y, p_public_key_y);
if(fill_vector(public_comp_key, p_public_compressed_key)){
fill_vector(public_key_x, p_public_key_x);
fill_vector(public_key_y, p_public_key_y);
if(fill_vector(public_comp_key, p_public_compressed_key)){
public_comp_key.insert(public_comp_key.begin(), (unsigned char)(2 + p_public_compressed_key_mode)); // Add one byte to indicate cmpressed-y-0 (0x02) or compressed-y-1 (0x03)
loggers::get_instance().log_to_hexa("security_cache::store_certificate: public_comp_key: ", public_comp_key.data(), public_comp_key.size());
}
 
fill_vector(hashed_id8, p_hashed_id8);
fill_vector(issuer, p_issuer);
fill_vector(private_enc_key, p_private_enc_key);
fill_vector(public_enc_key_x, p_public_enc_key_x);
fill_vector(public_enc_key_y, p_public_enc_key_y);
fill_vector(hashed_id8, p_hashed_id8);
fill_vector(issuer, p_issuer);
fill_vector(private_enc_key, p_private_enc_key);
fill_vector(public_enc_key_x, p_public_enc_key_x);
fill_vector(public_enc_key_y, p_public_enc_key_y);
if(fill_vector(public_enc_comp_key, p_public_enc_compressed_key)) {
public_enc_comp_key.insert(public_enc_comp_key.begin(), (unsigned char)(2 + p_public_compressed_key_mode)); // Add one byte to indicate cmpressed-y-0 (0x02) or compressed-y-1 (0x03)
loggers::get_instance().log_to_hexa("security_cache::store_certificate: public_enc_comp_key: ", public_enc_comp_key.data(), public_enc_comp_key.size());
270,7 → 270,7
}
_certificates.insert(std::pair<std::string, std::unique_ptr<security_db_record> >(key, std::unique_ptr<security_db_record>(p)));
_hashed_id8s.insert(std::pair<std::vector<unsigned char>, std::string&>(hashed_id8, key));
dump();
//dump();
 
return 0;
}