PBEWithSHA1And3Key3DESCBCAlgorithmIdentifier   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 36
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A hashFunc() 0 3 1
A name() 0 3 1
A blockCipher() 0 3 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\DESEDE3CBCAlgorithmIdentifier;
9
use Sop\PKCS5\HashFunc\HashFunc;
10
use Sop\PKCS5\HashFunc\SHA1;
11
12
/**
13
 * Algorithm identifier for password-based encryption scheme with SHA-1 and
14
 * 3-key triple-DES-CBC.
15
 *
16
 * @see https://tools.ietf.org/html/rfc7292#appendix-C
17
 */
18
class PBEWithSHA1And3Key3DESCBCAlgorithmIdentifier extends PBES1PKCS12AlgorithmIdentifier
19
{
20
    /**
21
     * Constructor.
22
     *
23
     * @param string $salt            Salt
24
     * @param int    $iteration_count Iteration count
25
     */
26 2
    public function __construct(string $salt, int $iteration_count)
27
    {
28 2
        parent::__construct($salt, $iteration_count);
29 2
        $this->_oid = self::OID_PBE_WITH_SHA1_AND_3KEY_3DES_CBC;
30 2
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function name(): string
36
    {
37 1
        return 'pbeWithSHAAnd3-KeyTripleDES-CBC';
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 1
    public function hashFunc(): HashFunc
44
    {
45 1
        return new SHA1();
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51 1
    public function blockCipher(): BlockCipherAlgorithmIdentifier
52
    {
53 1
        return new DESEDE3CBCAlgorithmIdentifier();
54
    }
55
}
56