Skip to content

Deprecate compression #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
Expand Down Expand Up @@ -30,6 +29,8 @@
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

//use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;

return static function (ECSConfig $config): void {
$header = '';
$config->import(SetList::PSR_12);
Expand All @@ -53,7 +54,7 @@
$config->rule(ProtectedToPrivateFixer::class);
$config->rule(DeclareStrictTypesFixer::class);
$config->rule(NativeConstantInvocationFixer::class);
$config->rule(MbStrFunctionsFixer::class);
//$config->rule(MbStrFunctionsFixer::class);
$config->rule(LinebreakAfterOpeningTagFixer::class);
$config->rule(CombineConsecutiveIssetsFixer::class);
$config->rule(CombineConsecutiveUnsetsFixer::class);
Expand Down
32 changes: 9 additions & 23 deletions performance/JWE/EncryptionBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,16 @@
*/
abstract class EncryptionBench
{
private AlgorithmManager $contentEncryptionAlgorithmsManager;

private AlgorithmManager $keyEncryptionAlgorithmsManager;
private AlgorithmManager $algorithmsManager;

private CompressionMethodManager $compressionMethodsManager;

private JWESerializerManager $serializerManager;

public function init(): void
{
$this->keyEncryptionAlgorithmsManager = new AlgorithmManager([
$this->algorithmsManager = new AlgorithmManager([
// Key Encryption
new A128KW(),
new A192KW(),
new A256KW(),
Expand All @@ -74,8 +73,8 @@ public function init(): void
new RSA15(),
new RSAOAEP(),
new RSAOAEP256(),
]);
$this->contentEncryptionAlgorithmsManager = new AlgorithmManager([

// Content Encryption
new A128CBCHS256(),
new A192CBCHS384(),
new A256CBCHS512(),
Expand All @@ -97,11 +96,7 @@ public function init(): void
*/
public function encryption(array $params): void
{
$jweBuilder = new JWEBuilder(
$this->getKeyEncryptionAlgorithmsManager(),
$this->getContentEncryptionAlgorithmsManager(),
$this->getCompressionMethodsManager()
);
$jweBuilder = new JWEBuilder($this->getAlgorithmsManager(), $this->getCompressionMethodsManager());
$jweBuilder
->withPayload($params['payload'])
->withAAD($this->getAAD())
Expand All @@ -118,11 +113,7 @@ public function encryption(array $params): void
*/
public function decryption(array $params): void
{
$jweLoader = new JWEDecrypter(
$this->getKeyEncryptionAlgorithmsManager(),
$this->getContentEncryptionAlgorithmsManager(),
$this->getCompressionMethodsManager()
);
$jweLoader = new JWEDecrypter($this->getAlgorithmsManager(), $this->getCompressionMethodsManager());
$jwe = $this->serializerManager->unserialize($params['input']);
$keyset = JWKSet::createFromKeyData($params['recipient_keys']);
$jweLoader->decryptUsingKeySet($jwe, $keyset, 0);
Expand All @@ -143,14 +134,9 @@ abstract public function dataRecipientPublicKeys(): array;

abstract protected function getAAD(): ?string;

private function getKeyEncryptionAlgorithmsManager(): AlgorithmManager
{
return $this->keyEncryptionAlgorithmsManager;
}

private function getContentEncryptionAlgorithmsManager(): AlgorithmManager
private function getAlgorithmsManager(): AlgorithmManager
{
return $this->contentEncryptionAlgorithmsManager;
return $this->algorithmsManager;
}

private function getCompressionMethodsManager(): CompressionMethodManager
Expand Down
Loading