improve variable naming

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-11-30 15:24:05 +01:00
parent 8796c6bc78
commit 34d4c2bc16
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 4 additions and 4 deletions

View File

@ -482,14 +482,14 @@ class Crypt {
* @throws GenericEncryptionException * @throws GenericEncryptionException
*/ */
private function checkSignature($data, $passPhrase, $expectedSignature) { private function checkSignature($data, $passPhrase, $expectedSignature) {
$skipSignatureCheck = $this->config->getSystemValue('encryption_skip_signature_check', false); $enforceSignature = !$this->config->getSystemValue('encryption_skip_signature_check', false);
$signature = $this->createSignature($data, $passPhrase); $signature = $this->createSignature($data, $passPhrase);
$hash = hash_equals($expectedSignature, $signature); $isCorrectHash = hash_equals($expectedSignature, $signature);
if (!$hash && $skipSignatureCheck === false) { if (!$isCorrectHash && $enforceSignature) {
throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature')); throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature'));
} else if (!$hash && $skipSignatureCheck) { } else if (!$isCorrectHash && !$enforceSignature) {
$this->logger->info("Signature check skipped", ['app' => 'encryption']); $this->logger->info("Signature check skipped", ['app' => 'encryption']);
} }
} }