Fix hydra-server signing

This commit is contained in:
Eelco Dolstra 2016-02-26 17:28:16 +01:00
parent 9de336de7c
commit b00bdefa98

View file

@ -36,13 +36,10 @@ sub process {
# Optionally, sign the NAR info file we just created. # Optionally, sign the NAR info file we just created.
my $secretKeyFile = $c->config->{binary_cache_secret_key_file}; my $secretKeyFile = $c->config->{binary_cache_secret_key_file};
if (defined $secretKeyFile) { if (defined $secretKeyFile) {
my $s = readFile $secretKeyFile; my $secretKey = readFile $secretKeyFile;
chomp $s;
my ($keyName, $secretKey) = split ":", $s;
die "invalid secret key file\n" unless defined $keyName && defined $secretKey;
my $fingerprint = fingerprintPath($storePath, $narHash, $narSize, $refs); my $fingerprint = fingerprintPath($storePath, $narHash, $narSize, $refs);
my $sig = encode_base64(signString(decode_base64($secretKey), $fingerprint), ""); my $sig = signString($secretKey, $fingerprint);
$info .= "Sig: $keyName:$sig\n"; $info .= "Sig: $sig\n";
} }
setCacheHeaders($c, 24 * 60 * 60); setCacheHeaders($c, 24 * 60 * 60);