AES::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Alg\Encryption;
6
7
use SimpleSAML\XMLSecurity\Constants as C;
8
use SimpleSAML\XMLSecurity\Key\SymmetricKey;
9
10
/**
11
 * Class implementing the AES family of encryption algorithms (both AES-CBC and AES-GCM).
12
 *
13
 * @package simplesamlphp/xml-security
14
 */
15
class AES extends AbstractEncryptor
16
{
17
    /**
18
     * AES constructor.
19
     *
20
     * @param \SimpleSAML\XMLSecurity\Key\SymmetricKey $key The symmetric key to use.
21
     * @param string $algId The identifier of this algorithm.
22
     */
23
    public function __construct(
24
        #[\SensitiveParameter]
25
        SymmetricKey $key,
26
        string $algId = C::BLOCK_ENC_AES256_GCM,
27
    ) {
28
        parent::__construct($key, $algId);
29
    }
30
31
32
    /**
33
     * @return string[]
34
     */
35
    public static function getSupportedAlgorithms(): array
36
    {
37
        return [
38
            C::BLOCK_ENC_AES128,
39
            C::BLOCK_ENC_AES192,
40
            C::BLOCK_ENC_AES256,
41
            C::BLOCK_ENC_AES128_GCM,
42
            C::BLOCK_ENC_AES192_GCM,
43
            C::BLOCK_ENC_AES256_GCM,
44
        ];
45
    }
46
}
47