mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
* `nix-store --export --sign': sign the Nix archive using the RSA key
in /nix/etc/nix/signing-key.sec
This commit is contained in:
parent
6c9fdb17fb
commit
46e0919ced
8 changed files with 125 additions and 32 deletions
|
@ -282,27 +282,36 @@ Hash hashFile(HashType ht, const Path & path)
|
|||
}
|
||||
|
||||
|
||||
struct HashSink : Sink
|
||||
HashSink::HashSink(HashType ht) : ht(ht)
|
||||
{
|
||||
HashType ht;
|
||||
Ctx ctx;
|
||||
virtual void operator ()
|
||||
(const unsigned char * data, unsigned int len)
|
||||
{
|
||||
update(ht, ctx, data, len);
|
||||
}
|
||||
};
|
||||
ctx = new Ctx;
|
||||
start(ht, *ctx);
|
||||
}
|
||||
|
||||
HashSink::~HashSink()
|
||||
{
|
||||
delete ctx;
|
||||
}
|
||||
|
||||
void HashSink::operator ()
|
||||
(const unsigned char * data, unsigned int len)
|
||||
{
|
||||
update(ht, *ctx, data, len);
|
||||
}
|
||||
|
||||
Hash HashSink::finish()
|
||||
{
|
||||
Hash hash(ht);
|
||||
nix::finish(ht, *ctx, hash.hash);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
Hash hashPath(HashType ht, const Path & path, PathFilter & filter)
|
||||
{
|
||||
HashSink sink;
|
||||
sink.ht = ht;
|
||||
Hash hash(ht);
|
||||
start(ht, sink.ctx);
|
||||
HashSink sink(ht);
|
||||
dumpPath(path, sink, filter);
|
||||
finish(ht, sink.ctx, hash.hash);
|
||||
return hash;
|
||||
return sink.finish();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue