provide a way to disable hs2019 for federation testing.

This commit is contained in:
nobody 2022-05-01 15:13:17 -07:00
parent 8de852c189
commit b5c820623f

View file

@ -510,6 +510,7 @@ class HTTPSig
$return_headers = [];
if ($alg === 'sha256') {
$algorithm = 'rsa-sha256';
}
@ -517,9 +518,15 @@ class HTTPSig
$algorithm = 'rsa-sha512';
}
// Use hs2019 by default.
if (get_config('system','use_hs2019',true) && $algorithm === 'rsa-sha512') {
$algorithm = 'hs2019';
}
$x = self::sign($head, $prvkey, $alg);
$headerval = 'keyId="' . $keyid . '",algorithm="' . (($algorithm === 'rsa-sha256') ? 'hs2019' : $algorithm) . '",headers="' . $x['headers'] . '",signature="' . $x['signature'] . '"';
$headerval = 'keyId="' . $keyid . '",algorithm="' . $algorithm . '",headers="' . $x['headers'] . '",signature="' . $x['signature'] . '"';
if ($encryption) {
$x = Crypto::encapsulate($headerval, $encryption['key'], $encryption['algorithm']);