diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2023-04-17 17:39:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 17:39:34 +0200 |
commit | b9520661406bc514ac16f11aeb85b1980d62f581 (patch) | |
tree | c24b05a974899a024b306da46bd818556a5cbaf6 /apps/encryption | |
parent | 54b5703233cae94540e2e934b2e88ef0b2288796 (diff) | |
parent | 2f653c8be80e52bc8697462240c6a4ec2bf01c5e (diff) | |
download | nextcloud-server-b9520661406bc514ac16f11aeb85b1980d62f581.tar.gz nextcloud-server-b9520661406bc514ac16f11aeb85b1980d62f581.zip |
Merge pull request #37724 from nextcloud/fix/encryption-signature-check-logic
Cleanup signature checking logic in encryption
Diffstat (limited to 'apps/encryption')
-rw-r--r-- | apps/encryption/lib/Crypto/Crypt.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index 22a697a1232..0cf6451d287 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -523,10 +523,12 @@ class Crypt { $signature = $this->createSignature($data, $passPhrase); $isCorrectHash = hash_equals($expectedSignature, $signature); - if (!$isCorrectHash && $enforceSignature) { - throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature')); - } elseif (!$isCorrectHash && !$enforceSignature) { - $this->logger->info("Signature check skipped", ['app' => 'encryption']); + if (!$isCorrectHash) { + if ($enforceSignature) { + throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature')); + } else { + $this->logger->info("Signature check skipped", ['app' => 'encryption']); + } } } |