Algorithm Management (JWA)
Last updated
Was this helpful?
Was this helpful?
<?php
use Jose\Component\Core\AlgorithmManagerFactory;
use Jose\Component\Signature\Algorithm\PS256;
use Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS512A256KW;
use Jose\Component\Encryption\Algorithm\ContentEncryption\A128CBCHS256;
$algorithm_manager_factory = new AlgorithmManagerFactory();
$algorithm_manager_factory
->add('PS256', new PS256())
->add('A128CBC-HS256', new A128CBCHS256())
->add('PBES2-HS512+A256KW', new PBES2HS512A256KW())
->add('PBES2-HS512+A256KW with custom configuration', new PBES2HS512A256KW(128, 8192))
;<?php
$signature_algorithm_manager = $algorithm_manager_factory->create(['PS256']);
$encryption_algorithm_manager = $algorithm_manager_factory->create(['A128CBC-HS256', 'PBES2-HS512+A256KW']);
$encryption_algorithm_manager_for_paranoid = $algorithm_manager_factory->create(['A128CBC-HS256', 'PBES2-HS512+A256KW with custom configuration']);