diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp index 17e7eb3e80ff71119cfa34937033f0a9d67c2868..c2ff3563d9c9a8c64d470a1520595767779a1046 100644 --- a/src/security/certstore.cpp +++ b/src/security/certstore.cpp @@ -68,11 +68,13 @@ 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"); + id = crt->getId().toString(); + longId = crt->getLongId().toString(); certs_.emplace(std::move(id), crt); certs_.emplace(std::move(longId), crt); loadRevocations(*crt);