Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0a94172

Browse filesBrowse files
committed
COmments and minros
1 parent 1b08da3 commit 0a94172
Copy full SHA for 0a94172

File tree

Expand file treeCollapse file tree

5 files changed

+6
-24
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+6
-24
lines changed

‎src/Symfony/Component/Encryption/AsymmetricEncryptionInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Encryption/AsymmetricEncryptionInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function generateKeypair(): array;
5151
* @param string $publicKey Bob's public key
5252
* @param string|null $privateKey Alice's private key. If a private key is provided, Bob is forced to verify that the message comes from Alice.
5353
*
54-
* @return string the output will be formatted according to JWE (RFC 7516)
54+
* @return string the output MUST be formatted according to JWE (RFC 7516)
5555
*
5656
* @throws EncryptionException
5757
*/

‎src/Symfony/Component/Encryption/JWE.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Encryption/JWE.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public function __toString()
145145
public function getString(): string
146146
{
147147
$headers = array_merge($this->headers, [
148-
'alg' => $this->algorithm ?? 'none', // he algorithm to encrypt the CEK.
149-
'enc' => $this->encryptionAlgorithm, // The algorithm to encrypt the payload.
148+
'alg' => $this->algorithm,
149+
'enc' => $this->encryptionAlgorithm,
150150
'cty' => 'plaintext',
151151
'com.symfony.authentication_tag' => 'sha256',
152152
]);
@@ -160,7 +160,7 @@ public function getString(): string
160160

161161
return sprintf('%s.%s.%s.%s.%s',
162162
$encodedHeader,
163-
self::base64UrlEncode($this->cek ?? 'none'),
163+
self::base64UrlEncode($this->cek),
164164
self::base64UrlEncode($this->initializationVector),
165165
self::base64UrlEncode($ciphertext),
166166
self::base64UrlEncode($hash)

‎src/Symfony/Component/Encryption/Provider/PhpseclibEncryption.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Encryption/Provider/PhpseclibEncryption.php
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function encrypt(string $message, ?string $publicKey = null, ?string $pri
8484
};
8585

8686
if (null === $publicKey && null === $privateKey) {
87-
$aes = new AES(); // could use AES::MODE_CBC
87+
$aes = new AES();
8888
$aes->setPassword($this->secret);
8989
$aes->setIV($nonce = Random::string($aes->getBlockLength() >> 3));
9090
$headers['com.symfony.extra_nonce'] = base64_encode($nonce);
@@ -144,7 +144,6 @@ public function decrypt(string $message, ?string $privateKey = null, ?string $pu
144144
}
145145

146146
$rsa->loadKey($privateKey);
147-
// $rsa->setEncryptionMode(RSA::ENCRYPTION_OAEP);
148147
$cek = $rsa->decrypt($encryptedCek);
149148
} else {
150149
throw new UnsupportedAlgorithmException($algorithm);
@@ -181,13 +180,4 @@ public static function throwError($type, $message, $file, $line)
181180
{
182181
throw new \ErrorException($message, 0, $type, $file, $line);
183182
}
184-
185-
private function symmetricEncryption(string $message, string $nonce, string $secret): string
186-
{
187-
$aes = new AES();
188-
$aes->setKey($secret);
189-
$aes->setIV($nonce);
190-
191-
return $aes->encrypt($message);
192-
}
193183
}

‎src/Symfony/Component/Encryption/Provider/SodiumEncryption.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Encryption/Provider/SodiumEncryption.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,4 @@ private function getSodiumKey(string $secret): string
158158

159159
return $secret;
160160
}
161-
162-
/**
163-
* @throws \SodiumException
164-
*/
165-
private function symmetricEncryption(string $message, string $nonce, string $secret): string
166-
{
167-
return sodium_crypto_secretbox($message, $nonce, $this->getSodiumKey($secret));
168-
}
169161
}

‎src/Symfony/Component/Encryption/SymmetricEncryptionInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Encryption/SymmetricEncryptionInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface SymmetricEncryptionInterface
3535
*
3636
* @param string $message plain text version of the message
3737
*
38-
* @return string the output will be formatted according to JWE (RFC 7516)
38+
* @return string the output MUST be formatted according to JWE (RFC 7516)
3939
*
4040
* @throws EncryptionException
4141
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.