Skip to content

Commit 48c2033

Browse files
authored
Deprecate compression (#539)
Deprecate Compression
1 parent 1dbef13 commit 48c2033

31 files changed

+366
-83
lines changed

ecs.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
65
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
76
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
87
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
@@ -30,6 +29,8 @@
3029
use Symplify\EasyCodingStandard\Config\ECSConfig;
3130
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
3231

32+
//use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
33+
3334
return static function (ECSConfig $config): void {
3435
$header = '';
3536
$config->import(SetList::PSR_12);
@@ -53,7 +54,7 @@
5354
$config->rule(ProtectedToPrivateFixer::class);
5455
$config->rule(DeclareStrictTypesFixer::class);
5556
$config->rule(NativeConstantInvocationFixer::class);
56-
$config->rule(MbStrFunctionsFixer::class);
57+
//$config->rule(MbStrFunctionsFixer::class);
5758
$config->rule(LinebreakAfterOpeningTagFixer::class);
5859
$config->rule(CombineConsecutiveIssetsFixer::class);
5960
$config->rule(CombineConsecutiveUnsetsFixer::class);

performance/JWE/EncryptionBench.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@
4646
*/
4747
abstract class EncryptionBench
4848
{
49-
private AlgorithmManager $contentEncryptionAlgorithmsManager;
50-
51-
private AlgorithmManager $keyEncryptionAlgorithmsManager;
49+
private AlgorithmManager $algorithmsManager;
5250

5351
private CompressionMethodManager $compressionMethodsManager;
5452

5553
private JWESerializerManager $serializerManager;
5654

5755
public function init(): void
5856
{
59-
$this->keyEncryptionAlgorithmsManager = new AlgorithmManager([
57+
$this->algorithmsManager = new AlgorithmManager([
58+
// Key Encryption
6059
new A128KW(),
6160
new A192KW(),
6261
new A256KW(),
@@ -74,8 +73,8 @@ public function init(): void
7473
new RSA15(),
7574
new RSAOAEP(),
7675
new RSAOAEP256(),
77-
]);
78-
$this->contentEncryptionAlgorithmsManager = new AlgorithmManager([
76+
77+
// Content Encryption
7978
new A128CBCHS256(),
8079
new A192CBCHS384(),
8180
new A256CBCHS512(),
@@ -97,11 +96,7 @@ public function init(): void
9796
*/
9897
public function encryption(array $params): void
9998
{
100-
$jweBuilder = new JWEBuilder(
101-
$this->getKeyEncryptionAlgorithmsManager(),
102-
$this->getContentEncryptionAlgorithmsManager(),
103-
$this->getCompressionMethodsManager()
104-
);
99+
$jweBuilder = new JWEBuilder($this->getAlgorithmsManager(), $this->getCompressionMethodsManager());
105100
$jweBuilder
106101
->withPayload($params['payload'])
107102
->withAAD($this->getAAD())
@@ -118,11 +113,7 @@ public function encryption(array $params): void
118113
*/
119114
public function decryption(array $params): void
120115
{
121-
$jweLoader = new JWEDecrypter(
122-
$this->getKeyEncryptionAlgorithmsManager(),
123-
$this->getContentEncryptionAlgorithmsManager(),
124-
$this->getCompressionMethodsManager()
125-
);
116+
$jweLoader = new JWEDecrypter($this->getAlgorithmsManager(), $this->getCompressionMethodsManager());
126117
$jwe = $this->serializerManager->unserialize($params['input']);
127118
$keyset = JWKSet::createFromKeyData($params['recipient_keys']);
128119
$jweLoader->decryptUsingKeySet($jwe, $keyset, 0);
@@ -143,14 +134,9 @@ abstract public function dataRecipientPublicKeys(): array;
143134

144135
abstract protected function getAAD(): ?string;
145136

146-
private function getKeyEncryptionAlgorithmsManager(): AlgorithmManager
147-
{
148-
return $this->keyEncryptionAlgorithmsManager;
149-
}
150-
151-
private function getContentEncryptionAlgorithmsManager(): AlgorithmManager
137+
private function getAlgorithmsManager(): AlgorithmManager
152138
{
153-
return $this->contentEncryptionAlgorithmsManager;
139+
return $this->algorithmsManager;
154140
}
155141

156142
private function getCompressionMethodsManager(): CompressionMethodManager

0 commit comments

Comments
 (0)