1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

Add C++ functions for .narinfo processing / signing

This is currently only used by the Hydra queue runner rework, but like
eff5021eaa it presumably will be useful
for the C++ rewrite of nix-push and
download-from-binary-cache. (@shlevy)
This commit is contained in:
Eelco Dolstra 2016-02-16 16:38:44 +01:00
parent 5ac27053e9
commit c4d22997f3
7 changed files with 304 additions and 17 deletions

View file

@ -258,13 +258,10 @@ for (my $n = 0; $n < scalar @storePaths2; $n++) {
}
if (defined $secretKeyFile) {
my $s = readFile $secretKeyFile;
chomp $s;
my ($keyName, $secretKey) = split ":", $s;
die "invalid secret key file $secretKeyFile\n" unless defined $keyName && defined $secretKey;
my $secretKey = readFile $secretKeyFile;
my $fingerprint = fingerprintPath($storePath, $narHash, $narSize, $refs);
my $sig = encode_base64(signString(decode_base64($secretKey), $fingerprint), "");
$info .= "Sig: $keyName:$sig\n";
my $sig = signString($secretKey, $fingerprint);
$info .= "Sig: $sig\n";
}
my $pathHash = substr(basename($storePath), 0, 32);