diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-03-21 18:05:47 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-03-21 18:05:47 +0100 |
commit | 712b616a8443b940e94ac443499246f4de6ee5cd (patch) | |
tree | cd4ab98dc9cd586c68da8a9096021c5e998fe513 /src/libstore/nar-info.cc | |
parent | cebc150b7ccf534612d7d8c75200c1717e986566 (diff) |
Move signatures from NarInfo to ValidPathInfo
This allows queryPathInfo() to return signatures.
Diffstat (limited to 'src/libstore/nar-info.cc')
-rw-r--r-- | src/libstore/nar-info.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libstore/nar-info.cc b/src/libstore/nar-info.cc index e9260a09b..9028370ac 100644 --- a/src/libstore/nar-info.cc +++ b/src/libstore/nar-info.cc @@ -66,7 +66,7 @@ NarInfo::NarInfo(const std::string & s, const std::string & whence) else if (name == "System") system = value; else if (name == "Sig") - sig = value; + sigs.insert(value); pos = eol + 1; } @@ -98,7 +98,7 @@ std::string NarInfo::to_string() const if (!system.empty()) res += "System: " + system + "\n"; - if (!sig.empty()) + for (auto sig : sigs) res += "Sig: " + sig + "\n"; return res; @@ -123,12 +123,16 @@ Strings NarInfo::shortRefs() const void NarInfo::sign(const SecretKey & secretKey) { - sig = secretKey.signDetached(fingerprint()); + sigs.insert(secretKey.signDetached(fingerprint())); } -bool NarInfo::checkSignature(const PublicKeys & publicKeys) const +unsigned int NarInfo::checkSignatures(const PublicKeys & publicKeys) const { - return sig != "" && verifyDetached(fingerprint(), sig, publicKeys); + unsigned int good = 0; + for (auto & sig : sigs) + if (verifyDetached(fingerprint(), sig, publicKeys)) + good++; + return good; } } |