mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Signer infrastructure: Prep for #9076
This sets up infrastructure in libutil to allow for signing other than by a secret key in memory. #9076 uses this to implement remote signing. (Split from that PR to allow reviewing in smaller chunks.) Co-Authored-By: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
parent
315aade89d
commit
12bb8cdd38
24 changed files with 233 additions and 70 deletions
31
src/libstore/keys.cc
Normal file
31
src/libstore/keys.cc
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "file-system.hh"
|
||||
#include "globals.hh"
|
||||
#include "keys.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
PublicKeys getDefaultPublicKeys()
|
||||
{
|
||||
PublicKeys publicKeys;
|
||||
|
||||
// FIXME: filter duplicates
|
||||
|
||||
for (auto s : settings.trustedPublicKeys.get()) {
|
||||
PublicKey key(s);
|
||||
publicKeys.emplace(key.name, key);
|
||||
}
|
||||
|
||||
for (auto secretKeyFile : settings.secretKeyFiles.get()) {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue