-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJWEDecrypterFactory.php
41 lines (35 loc) · 1.39 KB
/
JWEDecrypterFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
declare(strict_types=1);
namespace Jose\Component\Encryption;
use Jose\Component\Core\AlgorithmManagerFactory;
use Jose\Component\Encryption\Compression\CompressionMethodManagerFactory;
class JWEDecrypterFactory
{
public function __construct(
private readonly AlgorithmManagerFactory $algorithmManagerFactory,
private readonly CompressionMethodManagerFactory $compressionMethodManagerFactory
) {
}
/**
* Creates a JWE Decrypter object using the given key encryption algorithms, content encryption algorithms and
* compression methods.
*
* @param string[] $keyEncryptionAlgorithms
* @param string[] $contentEncryptionAlgorithms
* @param string[] $compressionMethods
*/
public function create(
array $keyEncryptionAlgorithms,
array $contentEncryptionAlgorithms,
array $compressionMethods
): JWEDecrypter {
$keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms);
$contentEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($contentEncryptionAlgorithms);
$compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods);
return new JWEDecrypter(
$keyEncryptionAlgorithmManager,
$contentEncryptionAlgorithmManager,
$compressionMethodManager
);
}
}