about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/crypto.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstore/crypto.cc b/src/libstore/crypto.cc
index 94c582d65ca7..747483afb30b 100644
--- a/src/libstore/crypto.cc
+++ b/src/libstore/crypto.cc
@@ -102,11 +102,24 @@ bool verifyDetached(const std::string & data, const std::string & sig,
 PublicKeys getDefaultPublicKeys()
 {
     PublicKeys publicKeys;
+
+    // FIXME: filter duplicates
+
     for (auto s : settings.get("binary-cache-public-keys", Strings())) {
         PublicKey key(s);
         publicKeys.emplace(key.name, key);
-        // FIXME: filter duplicates
     }
+
+    for (auto secretKeyFile : settings.get("secret-key-files", Strings())) {
+        try {
+            SecretKey secretKey(readFile(secretKeyFile));
+            publicKeys.emplace(secretKey.name, secretKey.toPublicKey());
+        } catch (SysError & e) {
+            /* Ignore unreadable key files. That's normal in a
+               multi-user installation. */
+        }
+    }
+
     return publicKeys;
 }