summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorjld3103 <jld3103yt@gmail.com>2023-04-14 08:47:39 +0200
committerjld3103 <jld3103yt@gmail.com>2023-04-14 09:07:20 +0200
commit2f653c8be80e52bc8697462240c6a4ec2bf01c5e (patch)
tree49ec85ce0492ae571af218e89f7cde4b12501588 /apps/encryption/lib
parent0951398af88455f28359d032f916474e3d8d2893 (diff)
downloadnextcloud-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.php10
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']);
+ }
}
}