Skip to content

Commit

Permalink
Replace getSystemValue in encryption app
Browse files Browse the repository at this point in the history
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
  • Loading branch information
J0WI committed Dec 5, 2022
1 parent e36e92b commit 045ca0d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/encryption/lib/Command/FixEncryptedVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function configure(): void {
}

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) {
Expand Down
6 changes: 3 additions & 3 deletions apps/encryption/lib/Crypto/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private function getCachedCipher() {
}

// 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(
Expand Down Expand Up @@ -524,7 +524,7 @@ public function symmetricDecryptFileContent($keyFileContents, $passPhrase, $ciph
* @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);
Expand Down Expand Up @@ -605,7 +605,7 @@ private function splitMetaData($catFile, $cipher) {
* @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');
Expand Down
8 changes: 4 additions & 4 deletions apps/encryption/tests/Crypto/CryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testGetOpenSSLConfig() {
*/
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');

Expand Down Expand Up @@ -165,7 +165,7 @@ public function testGetCipherWithInvalidCipher() {
*/
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);

Expand Down Expand Up @@ -208,7 +208,7 @@ public function testConcatIV() {
* @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']);
Expand All @@ -235,7 +235,7 @@ public function dataTestSplitMetaData() {
* @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,
Expand Down

0 comments on commit 045ca0d

Please sign in to comment.