Skip to content

Commit f2912ce

Browse files
committed
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>
1 parent 7148257 commit f2912ce

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

apps/encryption/lib/Crypto/Crypt.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
* @author Björn Schießle <bjoern@schiessle.org>
77
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
88
* @author Clark Tomlinson <fallen013@gmail.com>
9+
* @author Côme Chilliet <come.chilliet@nextcloud.com>
910
* @author Joas Schilling <coding@schilljs.com>
11+
* @author Kevin Niehage <kevin@niehage.name>
1012
* @author Lukas Reschke <lukas@statuscode.ch>
1113
* @author Morris Jobke <hey@morrisjobke.de>
1214
* @author Roeland Jago Douma <roeland@famdouma.nl>
1315
* @author Stefan Weiberg <sweiberg@suse.com>
1416
* @author Thomas Müller <thomas.mueller@tmit.eu>
15-
* @author Kevin Niehage <kevin@niehage.name>
1617
*
1718
* @license AGPL-3.0
1819
*
@@ -761,8 +762,9 @@ public function useLegacyBase64Encoding(): bool {
761762
/**
762763
* Uses phpseclib RC4 implementation
763764
*/
764-
protected function rc4Decrypt(string $data, string $secret): string {
765+
private function rc4Decrypt(string $data, string $secret): string {
765766
$rc4 = new RC4();
767+
/** @psalm-suppress InternalMethod */
766768
$rc4->setKey($secret);
767769

768770
return $rc4->decrypt($data);
@@ -771,21 +773,21 @@ protected function rc4Decrypt(string $data, string $secret): string {
771773
/**
772774
* Uses phpseclib RC4 implementation
773775
*/
774-
protected function rc4Encrypt(string $data, string $secret): string {
776+
private function rc4Encrypt(string $data, string $secret): string {
775777
$rc4 = new RC4();
778+
/** @psalm-suppress InternalMethod */
776779
$rc4->setKey($secret);
777780

778781
return $rc4->encrypt($data);
779782
}
780783

781784
/**
782-
* wraps openssl_open() for cases where RC4 is not supported by OpenSSL v3
783-
* and replaces it with a custom implementation where necessary
785+
* Custom implementation of openssl_open()
784786
*
785787
* @param \OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $private_key
786788
* @throws DecryptionFailedException
787789
*/
788-
public function opensslOpen(string $data, string &$output, string $encrypted_key, $private_key, string $cipher_algo): bool {
790+
private function opensslOpen(string $data, string &$output, string $encrypted_key, $private_key, string $cipher_algo): bool {
789791
$result = false;
790792

791793
// check if RC4 is used
@@ -809,7 +811,7 @@ public function opensslOpen(string $data, string &$output, string $encrypted_key
809811
*
810812
* @throws EncryptionFailedException
811813
*/
812-
public function opensslSeal(string $data, string &$sealed_data, array &$encrypted_keys, array $public_key, string $cipher_algo): int|false {
814+
private function opensslSeal(string $data, string &$sealed_data, array &$encrypted_keys, array $public_key, string $cipher_algo): int|false {
813815
$result = false;
814816

815817
// check if RC4 is used

0 commit comments

Comments
 (0)