summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-11-27 11:08:41 +0100
committerBjoern Schiessle <bjoern@schiessle.org>2018-11-27 11:08:41 +0100
commit7a61ffc3ddb2fa377074335f13080468eb29b3dc (patch)
tree3b6df2e977acd614a65be02f6cbeefb0422612f1 /apps/encryption/lib
parent68ad2ae11873933ca2212df5a141e49cafa83c33 (diff)
downloadnextcloud-server-7a61ffc3ddb2fa377074335f13080468eb29b3dc.tar.gz
nextcloud-server-7a61ffc3ddb2fa377074335f13080468eb29b3dc.zip
Allow to disable the signature check
This allows you to recover encryption files even if the signature is broken Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/Crypto/Crypt.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php
index 70c99f808ba..a22d4551566 100644
--- a/apps/encryption/lib/Crypto/Crypt.php
+++ b/apps/encryption/lib/Crypto/Crypt.php
@@ -482,9 +482,15 @@ class Crypt {
* @throws GenericEncryptionException
*/
private function checkSignature($data, $passPhrase, $expectedSignature) {
+ $skipSignatureCheck = $this->config->getSystemValue('encryption_skip_signature_check', false);
+
$signature = $this->createSignature($data, $passPhrase);
- if (!hash_equals($expectedSignature, $signature)) {
+ $hash = hash_equals($expectedSignature, $signature);
+
+ if (!$hash && $skipSignatureCheck === false) {
throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature'));
+ } else if (!$hash && $skipSignatureCheck) {
+ $this->logger->info("Signature check skipped", ['app' => 'encryption']);
}
}