aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-08-11 19:26:41 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2020-08-11 19:26:41 +0200
commit9975b80d41f32e3210dfb50dcf41d6cb72fd9121 (patch)
tree3642195c1f3e019d5b2c178a71df9b941dca38b7 /apps/encryption/lib
parenta7875c24315ea4dee0bc164835418091229ae7f0 (diff)
downloadnextcloud-server-9975b80d41f32e3210dfb50dcf41d6cb72fd9121.tar.gz
nextcloud-server-9975b80d41f32e3210dfb50dcf41d6cb72fd9121.zip
SSE enhancement
Do not blind concatenate ints. Lets add a _ between them. So that we can distrinquis them properly Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/Crypto/Crypt.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php
index e990f5a510e..7723b63a66b 100644
--- a/apps/encryption/lib/Crypto/Crypt.php
+++ b/apps/encryption/lib/Crypto/Crypt.php
@@ -189,7 +189,7 @@ class Crypt {
$this->getCipher());
// Create a signature based on the key as well as the current version
- $sig = $this->createSignature($encryptedContent, $passPhrase.$version.$position);
+ $sig = $this->createSignature($encryptedContent, $passPhrase.'_'.$version.'_'.$position);
// combine content to encrypt the IV identifier and actual IV
$catFile = $this->concatIV($encryptedContent, $iv);
@@ -460,7 +460,13 @@ class Crypt {
$catFile = $this->splitMetaData($keyFileContents, $cipher);
if ($catFile['signature'] !== false) {
- $this->checkSignature($catFile['encrypted'], $passPhrase.$version.$position, $catFile['signature']);
+ try {
+ // First try the new format
+ $this->checkSignature($catFile['encrypted'], $passPhrase . '_' . $version . '_' . $position, $catFile['signature']);
+ } catch (GenericEncryptionException $e) {
+ // For compatibility with old files check the version without _
+ $this->checkSignature($catFile['encrypted'], $passPhrase . $version . $position, $catFile['signature']);
+ }
}
return $this->decrypt($catFile['encrypted'],