Skip to content
Snippets Groups Projects
Commit 68af7c73 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

certstore: fix id loading

Change-Id: If02e9f70726e9506b54d69048a4996f3c1bd3f8f
parent 98acf8ed
No related branches found
No related tags found
No related merge requests found
...@@ -68,11 +68,11 @@ CertificateStore::loadLocalCertificates() ...@@ -68,11 +68,11 @@ CertificateStore::loadLocalCertificates()
try { try {
auto crt = std::make_shared<crypto::Certificate>( auto crt = std::make_shared<crypto::Certificate>(
fileutils::loadFile(certPath_ + DIR_SEPARATOR_CH + f)); fileutils::loadFile(certPath_ + DIR_SEPARATOR_CH + f));
while (crt) {
auto id = crt->getId().toString(); auto id = crt->getId().toString();
auto longId = crt->getLongId().toString(); auto longId = crt->getLongId().toString();
if (id != f && longId != f) if (id != f && longId != f)
throw std::logic_error("Certificate id mismatch"); throw std::logic_error("Certificate id mismatch");
while (crt) {
certs_.emplace(std::move(id), crt); certs_.emplace(std::move(id), crt);
certs_.emplace(std::move(longId), crt); certs_.emplace(std::move(longId), crt);
loadRevocations(*crt); loadRevocations(*crt);
...@@ -80,6 +80,7 @@ CertificateStore::loadLocalCertificates() ...@@ -80,6 +80,7 @@ CertificateStore::loadLocalCertificates()
++n; ++n;
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
JAMI_WARN() << "Remove cert. " << e.what();
remove((certPath_ + DIR_SEPARATOR_CH + f).c_str()); remove((certPath_ + DIR_SEPARATOR_CH + f).c_str());
} }
} }
...@@ -396,7 +397,8 @@ void ...@@ -396,7 +397,8 @@ void
CertificateStore::pinRevocationList(const std::string& id, const dht::crypto::RevocationList& crl) CertificateStore::pinRevocationList(const std::string& id, const dht::crypto::RevocationList& crl)
{ {
fileutils::check_dir((crlPath_ + DIR_SEPARATOR_CH + id).c_str()); fileutils::check_dir((crlPath_ + DIR_SEPARATOR_CH + id).c_str());
fileutils::saveFile(crlPath_ + DIR_SEPARATOR_CH + id + DIR_SEPARATOR_CH + dht::toHex(crl.getNumber()), fileutils::saveFile(crlPath_ + DIR_SEPARATOR_CH + id + DIR_SEPARATOR_CH
+ dht::toHex(crl.getNumber()),
crl.getPacked()); crl.getPacked());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment