summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-31 16:34:48 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-07 22:09:29 +0200
commitfb4850ffa8127168a048538ce84dd909ff6553f4 (patch)
tree04b2ac0b70ec311576410363fe609925083d4725
parent1937e6eb356e5a5cf202b5aa2d75ee4ce9b55e18 (diff)
downloadnextcloud-server-fb4850ffa8127168a048538ce84dd909ff6553f4.tar.gz
nextcloud-server-fb4850ffa8127168a048538ce84dd909ff6553f4.zip
Fix intergrity checker
* Set salt length to 0 See https://tools.ietf.org/html/rfc3447#page-38 * Fix tests for new phpunit
-rw-r--r--lib/private/IntegrityCheck/Checker.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php
index e6eeaec7349..1db20772b4e 100644
--- a/lib/private/IntegrityCheck/Checker.php
+++ b/lib/private/IntegrityCheck/Checker.php
@@ -249,6 +249,8 @@ class Checker {
$privateKey->setSignatureMode(RSA::SIGNATURE_PSS);
$privateKey->setMGFHash('sha512');
+ // See https://tools.ietf.org/html/rfc3447#page-38
+ $privateKey->setSaltLength(0);
$signature = $privateKey->sign(json_encode($hashes));
return [
@@ -343,7 +345,7 @@ class Checker {
// Verify if certificate has proper CN. "core" CN is always trusted.
if($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') {
throw new InvalidSignatureException(
- sprintf('Certificate is not valid for required scope. (Requested: %s, current: %s)', $certificateCN, $x509->getDN(true))
+ sprintf('Certificate is not valid for required scope. (Requested: %s, current: CN=%s)', $certificateCN, $x509->getDN(true)['CN'])
);
}
@@ -352,6 +354,8 @@ class Checker {
$rsa->loadKey($x509->currentCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']);
$rsa->setSignatureMode(RSA::SIGNATURE_PSS);
$rsa->setMGFHash('sha512');
+ // See https://tools.ietf.org/html/rfc3447#page-38
+ $rsa->setSaltLength(0);
if(!$rsa->verify(json_encode($expectedHashes), $signature)) {
throw new InvalidSignatureException('Signature could not get verified.');
}