diff options
author | jld3103 <jld3103yt@gmail.com> | 2023-04-14 08:47:39 +0200 |
---|---|---|
committer | jld3103 <jld3103yt@gmail.com> | 2023-04-14 09:07:20 +0200 |
commit | 2f653c8be80e52bc8697462240c6a4ec2bf01c5e (patch) | |
tree | 49ec85ce0492ae571af218e89f7cde4b12501588 /apps/encryption/lib | |
parent | 0951398af88455f28359d032f916474e3d8d2893 (diff) | |
download | nextcloud-server-2f653c8be80e52bc8697462240c6a4ec2bf01c5e.tar.gz nextcloud-server-2f653c8be80e52bc8697462240c6a4ec2bf01c5e.zip |
Cleanup signature checking logic in encryption
Signed-off-by: jld3103 <jld3103yt@gmail.com>
Diffstat (limited to 'apps/encryption/lib')
-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']); + } } } |