Merge pull request #22210 from nextcloud/backport/22196/stable19
[stable19] SSE enhancement of file signature
This commit is contained in:
commit
8ffc3c0de6
|
@ -189,7 +189,7 @@ class Crypt {
|
||||||
$this->getCipher());
|
$this->getCipher());
|
||||||
|
|
||||||
// Create a signature based on the key as well as the current version
|
// 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
|
// combine content to encrypt the IV identifier and actual IV
|
||||||
$catFile = $this->concatIV($encryptedContent, $iv);
|
$catFile = $this->concatIV($encryptedContent, $iv);
|
||||||
|
@ -460,7 +460,13 @@ class Crypt {
|
||||||
$catFile = $this->splitMetaData($keyFileContents, $cipher);
|
$catFile = $this->splitMetaData($keyFileContents, $cipher);
|
||||||
|
|
||||||
if ($catFile['signature'] !== false) {
|
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'],
|
return $this->decrypt($catFile['encrypted'],
|
||||||
|
|
Loading…
Reference in New Issue