blockCipher()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\PKCS5\ASN1\AlgorithmIdentifier;
6
7
use Sop\CryptoTypes\AlgorithmIdentifier\Cipher\BlockCipherAlgorithmIdentifier;
8
use Sop\CryptoTypes\AlgorithmIdentifier\Cipher\DESCBCAlgorithmIdentifier;
9
use Sop\PKCS5\HashFunc\HashFunc;
10
use Sop\PKCS5\HashFunc\MD5;
11
12
/**
13
 * Algorithm identifier for password-based encryption scheme with MD5 and DES.
14
 *
15
 * @see https://tools.ietf.org/html/rfc2898#appendix-A.3
16
 */
17
class PBEWithMD5AndDESCBCAlgorithmIdentifier extends PBES1PKCS5AlgorithmIdentifier
18
{
19
    /**
20
     * Constructor.
21
     *
22
     * @param string $salt            Salt
23
     * @param int    $iteration_count Iteration count
24
     */
25 4
    public function __construct(string $salt, int $iteration_count)
26
    {
27 4
        parent::__construct($salt, $iteration_count);
28 3
        $this->_oid = self::OID_PBE_WITH_MD5_AND_DES_CBC;
29 3
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function name(): string
35
    {
36 1
        return 'pbeWithMD5AndDES-CBC';
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 2
    public function hashFunc(): HashFunc
43
    {
44 2
        return new MD5();
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 2
    public function blockCipher(): BlockCipherAlgorithmIdentifier
51
    {
52 2
        return new DESCBCAlgorithmIdentifier();
53
    }
54
}
55