Skip to content

Commit 1deb049

Browse files
committed
Refactor RSAParameters to rename private methods for encrypting and decrypting private keys, improving consistency and readability
1 parent b25e788 commit 1deb049

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/RSAParameters.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function generateKeys(?string $passphrase = null, ?array $configArgs = nu
3333

3434
if ($keys) {
3535
openssl_pkey_export($keys, $private);
36-
$this->privateKey = $this->_encryptPrivateKey(privateKey: $private);
36+
$this->privateKey = $this->encryptPrivateKey(privateKey: $private);
3737

3838
$pub = openssl_pkey_get_details($keys);
3939

@@ -45,7 +45,7 @@ public function generateKeys(?string $passphrase = null, ?array $configArgs = nu
4545
return $this;
4646
}
4747

48-
private function _encryptPrivateKey(string $privateKey, string $salt = 'salt'): string
48+
private function encryptPrivateKey(string $privateKey, string $salt = 'salt'): string
4949
{
5050
$aes = new AESCryptoServiceProvider();
5151
$aes->generateIV();
@@ -56,7 +56,7 @@ private function _encryptPrivateKey(string $privateKey, string $salt = 'salt'):
5656
return $aes->encrypt($privateKey);
5757
}
5858

59-
private function _decryptPrivateKey(string $privateKey, string $salt = 'salt'): string
59+
private function decryptPrivateKey(string $privateKey, string $salt = 'salt'): string
6060
{
6161
$aes = new AESCryptoServiceProvider();
6262
$k = new CryptoKey();
@@ -75,7 +75,7 @@ private function _decryptPrivateKey(string $privateKey, string $salt = 'salt'):
7575
public function getPrivateKey(string $salt = 'salt', bool $encrypted = false): \OpenSSLAsymmetricKey|string
7676
{
7777
if (!$encrypted) {
78-
return $this->_decryptPrivateKey(
78+
return $this->decryptPrivateKey(
7979
privateKey: $this->privateKey,
8080
salt: $salt
8181
);

0 commit comments

Comments
 (0)