|
|
|
@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
|
|
|
|
|
#include <string.h> |
|
|
|
|
#include "util.h" |
|
|
|
|
#include <openssl/evp.h> |
|
|
|
|
#include <openssl/ssl.h> |
|
|
|
|
#include "FS.h" |
|
|
|
|
#include "Log.h" |
|
|
|
|
#include "Crypto.h" |
|
|
|
|
#include "Family.h" |
|
|
|
@ -84,21 +84,24 @@ namespace data
@@ -84,21 +84,24 @@ namespace data
|
|
|
|
|
|
|
|
|
|
void Families::LoadCertificates () |
|
|
|
|
{ |
|
|
|
|
boost::filesystem::path familyDir = i2p::util::filesystem::GetCertificatesDir() / "family"; |
|
|
|
|
|
|
|
|
|
if (!boost::filesystem::exists (familyDir)) return; |
|
|
|
|
std::string certDir = i2p::fs::DataDirPath("certificates", "family"); |
|
|
|
|
std::vector<std::string> files; |
|
|
|
|
int numCertificates = 0; |
|
|
|
|
boost::filesystem::directory_iterator end; // empty
|
|
|
|
|
for (boost::filesystem::directory_iterator it (familyDir); it != end; ++it) |
|
|
|
|
{ |
|
|
|
|
if (boost::filesystem::is_regular_file (it->status()) && it->path ().extension () == ".crt") |
|
|
|
|
{ |
|
|
|
|
LoadCertificate (it->path ().string ()); |
|
|
|
|
numCertificates++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!i2p::fs::ReadDir(certDir, files)) { |
|
|
|
|
LogPrint(eLogWarning, "Reseed: Can't load reseed certificates from ", certDir); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (const std::string & file : files) { |
|
|
|
|
if (file.compare(file.size() - 4, 4, ".crt") != 0) { |
|
|
|
|
LogPrint(eLogWarning, "Family: ignoring file ", file); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
LoadCertificate (file); |
|
|
|
|
numCertificates++; |
|
|
|
|
} |
|
|
|
|
if (numCertificates > 0) |
|
|
|
|
LogPrint (eLogInfo, "Family: ", numCertificates, " certificates loaded"); |
|
|
|
|
LogPrint (eLogInfo, "Family: ", numCertificates, " certificates loaded"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Families::VerifyFamily (const std::string& family, const IdentHash& ident, |
|
|
|
@ -116,7 +119,6 @@ namespace data
@@ -116,7 +119,6 @@ namespace data
|
|
|
|
|
// TODO: process key
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|