Passed
Pull Request — master (#26)
by Jaime Pérez
02:10
created

TripleDES   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedAlgorithms() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Alg\Encryption;
6
7
use SimpleSAML\XMLSecurity\Backend\OpenSSL;
8
use SimpleSAML\XMLSecurity\Constants as C;
9
use SimpleSAML\XMLSecurity\Key\SymmetricKey;
10
11
/**
12
 * Class implementing the 3DES encryption algorithm.
13
 *
14
 * @package simplesamlphp/xml-security
15
 */
16
class TripleDES extends AbstractEncryptor
17
{
18
    /** @var string */
19
    protected string $default_backend = OpenSSL::class;
20
21
22
    /**
23
     * 3DES constructor.
24
     *
25
     * @param \SimpleSAML\XMLSecurity\Key\SymmetricKey $key The symmetric key to use.
26
     */
27
    public function __construct(SymmetricKey $key)
28
    {
29
        parent::__construct($key, C::BLOCK_ENC_3DES);
30
    }
31
32
33
    /**
34
     * @inheritDoc
35
     */
36
    public static function getSupportedAlgorithms(): array
37
    {
38
        return [C::BLOCK_ENC_3DES];
39
    }
40
}