From f2912ce8bcd4316b587e249d3deb94c461caddaf Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Tue, 21 Feb 2023 11:20:59 +0100 Subject: Set functions as private to be able to refactor later MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also a few comment fixes Signed-off-by: Côme Chilliet --- apps/encryption/lib/Crypto/Crypt.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index 2f188eec760..fe9813a6cfa 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -6,13 +6,14 @@ * @author Björn Schießle * @author Christoph Wurst * @author Clark Tomlinson + * @author Côme Chilliet * @author Joas Schilling + * @author Kevin Niehage * @author Lukas Reschke * @author Morris Jobke * @author Roeland Jago Douma * @author Stefan Weiberg * @author Thomas Müller - * @author Kevin Niehage * * @license AGPL-3.0 * @@ -761,8 +762,9 @@ class Crypt { /** * Uses phpseclib RC4 implementation */ - protected function rc4Decrypt(string $data, string $secret): string { + private function rc4Decrypt(string $data, string $secret): string { $rc4 = new RC4(); + /** @psalm-suppress InternalMethod */ $rc4->setKey($secret); return $rc4->decrypt($data); @@ -771,21 +773,21 @@ class Crypt { /** * Uses phpseclib RC4 implementation */ - protected function rc4Encrypt(string $data, string $secret): string { + private function rc4Encrypt(string $data, string $secret): string { $rc4 = new RC4(); + /** @psalm-suppress InternalMethod */ $rc4->setKey($secret); return $rc4->encrypt($data); } /** - * wraps openssl_open() for cases where RC4 is not supported by OpenSSL v3 - * and replaces it with a custom implementation where necessary + * Custom implementation of openssl_open() * * @param \OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $private_key * @throws DecryptionFailedException */ - public function opensslOpen(string $data, string &$output, string $encrypted_key, $private_key, string $cipher_algo): bool { + private function opensslOpen(string $data, string &$output, string $encrypted_key, $private_key, string $cipher_algo): bool { $result = false; // check if RC4 is used @@ -809,7 +811,7 @@ class Crypt { * * @throws EncryptionFailedException */ - public function opensslSeal(string $data, string &$sealed_data, array &$encrypted_keys, array $public_key, string $cipher_algo): int|false { + private function opensslSeal(string $data, string &$sealed_data, array &$encrypted_keys, array $public_key, string $cipher_algo): int|false { $result = false; // check if RC4 is used -- cgit v1.2.3