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()
try {
auto crt = std::make_shared<crypto::Certificate>(
fileutils::loadFile(certPath_ + DIR_SEPARATOR_CH + f));
auto id = crt->getId().toString();
auto longId = crt->getLongId().toString();
if (id != f && longId != f)
throw std::logic_error("Certificate id mismatch");
while (crt) {
auto id = crt->getId().toString();
auto longId = crt->getLongId().toString();
if (id != f && longId != f)
throw std::logic_error("Certificate id mismatch");
certs_.emplace(std::move(id), crt);
certs_.emplace(std::move(longId), crt);
loadRevocations(*crt);
......@@ -80,6 +80,7 @@ CertificateStore::loadLocalCertificates()
++n;
}
} catch (const std::exception& e) {
JAMI_WARN() << "Remove cert. " << e.what();
remove((certPath_ + DIR_SEPARATOR_CH + f).c_str());
}
}
......@@ -396,7 +397,8 @@ void
CertificateStore::pinRevocationList(const std::string& id, const dht::crypto::RevocationList& crl)
{
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());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment