summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-02-21 11:20:59 +0100
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2023-02-21 13:36:25 +0000
commitf2912ce8bcd4316b587e249d3deb94c461caddaf (patch)
treecfc311f37de719cc0ccab3204526870301a5b15f
parent71482576ad9ab0a2231e792d4a30605651fefb02 (diff)
downloadnextcloud-server-f2912ce8bcd4316b587e249d3deb94c461caddaf.tar.gz
nextcloud-server-f2912ce8bcd4316b587e249d3deb94c461caddaf.zip
Set functions as private to be able to refactor later
Also a few comment fixes Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/encryption/lib/Crypto/Crypt.php16
1 files 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 <bjoern@schiessle.org>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Clark Tomlinson <fallen013@gmail.com>
+ * @author Côme Chilliet <come.chilliet@nextcloud.com>
* @author Joas Schilling <coding@schilljs.com>
+ * @author Kevin Niehage <kevin@niehage.name>
* @author Lukas Reschke <lukas@statuscode.ch>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Stefan Weiberg <sweiberg@suse.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Kevin Niehage <kevin@niehage.name>
*
* @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