]> source.dussan.org Git - nextcloud-server.git/commitdiff
Replace getSystemValue in encryption app 35590/head
authorJ0WI <J0WI@users.noreply.github.com>
Sun, 4 Dec 2022 20:36:10 +0000 (21:36 +0100)
committerJ0WI <J0WI@users.noreply.github.com>
Mon, 5 Dec 2022 13:30:58 +0000 (14:30 +0100)
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
apps/encryption/lib/Command/FixEncryptedVersion.php
apps/encryption/lib/Crypto/Crypt.php
apps/encryption/tests/Crypto/CryptTest.php

index ab9cc528c54be84f713318f0f8acce95c380ef9f..cace88476f88f04fc1088a6c46acee7fbfc4462f 100644 (file)
@@ -95,7 +95,7 @@ class FixEncryptedVersion extends Command {
        }
 
        protected function execute(InputInterface $input, OutputInterface $output): int {
-               $skipSignatureCheck = $this->config->getSystemValue('encryption_skip_signature_check', false);
+               $skipSignatureCheck = $this->config->getSystemValueBool('encryption_skip_signature_check', false);
                $this->supportLegacy = $this->config->getSystemValueBool('encryption.legacy_format_support', false);
 
                if ($skipSignatureCheck) {
index f8ba3d69b80f84e8a2a745b0f2a21d3a8e5ec30d..7429c613b5266bba6a57f77ff4f3b30d4a9deba3 100644 (file)
@@ -275,7 +275,7 @@ class Crypt {
                }
 
                // Get cipher either from config.php or the default cipher defined in this class
-               $cipher = $this->config->getSystemValue('cipher', self::DEFAULT_CIPHER);
+               $cipher = $this->config->getSystemValueString('cipher', self::DEFAULT_CIPHER);
                if (!isset(self::SUPPORTED_CIPHERS_AND_KEY_SIZE[$cipher])) {
                        $this->logger->warning(
                                sprintf(
@@ -524,7 +524,7 @@ class Crypt {
         * @throws GenericEncryptionException
         */
        private function checkSignature($data, $passPhrase, $expectedSignature) {
-               $enforceSignature = !$this->config->getSystemValue('encryption_skip_signature_check', false);
+               $enforceSignature = !$this->config->getSystemValueBool('encryption_skip_signature_check', false);
 
                $signature = $this->createSignature($data, $passPhrase);
                $isCorrectHash = hash_equals($expectedSignature, $signature);
@@ -605,7 +605,7 @@ class Crypt {
         * @throws GenericEncryptionException
         */
        private function hasSignature($catFile, $cipher) {
-               $skipSignatureCheck = $this->config->getSystemValue('encryption_skip_signature_check', false);
+               $skipSignatureCheck = $this->config->getSystemValueBool('encryption_skip_signature_check', false);
 
                $meta = substr($catFile, -93);
                $signaturePosition = strpos($meta, '00sig00');
index ef4e46085a4c1dae103eb4b6ed5b806ab1fc8a01..08d0bba26685649bb063d74f931fd4f405427907 100644 (file)
@@ -111,7 +111,7 @@ class CryptTest extends TestCase {
         */
        public function testGenerateHeader($keyFormat, $expected) {
                $this->config->expects($this->once())
-                       ->method('getSystemValue')
+                       ->method('getSystemValueString')
                        ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR'))
                        ->willReturn('AES-128-CFB');
 
@@ -147,7 +147,7 @@ class CryptTest extends TestCase {
 
        public function testGetCipherWithInvalidCipher() {
                $this->config->expects($this->once())
-                               ->method('getSystemValue')
+                               ->method('getSystemValueString')
                                ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR'))
                                ->willReturn('Not-Existing-Cipher');
                $this->logger
@@ -165,7 +165,7 @@ class CryptTest extends TestCase {
         */
        public function testGetCipher($configValue, $expected) {
                $this->config->expects($this->once())
-                       ->method('getSystemValue')
+                       ->method('getSystemValueString')
                        ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR'))
                        ->willReturn($configValue);
 
@@ -208,7 +208,7 @@ class CryptTest extends TestCase {
         * @dataProvider dataTestSplitMetaData
         */
        public function testSplitMetaData($data, $expected) {
-               $this->config->method('getSystemValue')
+               $this->config->method('getSystemValueBool')
                        ->with('encryption_skip_signature_check', false)
                        ->willReturn(true);
                $result = self::invokePrivate($this->crypt, 'splitMetaData', [$data, 'AES-256-CFB']);
@@ -235,7 +235,7 @@ class CryptTest extends TestCase {
         * @dataProvider dataTestHasSignature
         */
        public function testHasSignature($data, $expected) {
-               $this->config->method('getSystemValue')
+               $this->config->method('getSystemValueBool')
                        ->with('encryption_skip_signature_check', false)
                        ->willReturn(true);
                $this->assertSame($expected,