diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index b03f8a4ddce14..7429b230bf482 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -91,18 +91,10 @@ public function encrypt(string $plaintext, string $password = ''): string { */ public function decrypt(string $authenticatedCiphertext, string $password = ''): string { $secret = $this->config->getSystemValue('secret'); - try { - if ($password === '') { - return $this->decryptWithoutSecret($authenticatedCiphertext, $secret); - } - return $this->decryptWithoutSecret($authenticatedCiphertext, $password); - } catch (Exception $e) { - if ($password === '') { - // Retry with empty secret as a fallback for instances where the secret might not have been set by accident - return $this->decryptWithoutSecret($authenticatedCiphertext, ''); - } - throw $e; + if ($password === '') { + return $this->decryptWithoutSecret($authenticatedCiphertext, $secret); } + return $this->decryptWithoutSecret($authenticatedCiphertext, $password); } private function decryptWithoutSecret(string $authenticatedCiphertext, string $password = ''): string {