1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Fhp\DataElementGroups; |
4
|
|
|
|
5
|
|
|
use Fhp\Deg; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class EncryptionAlgorithm. |
9
|
|
|
* |
10
|
|
|
* @package Fhp\DataElementGroups |
11
|
|
|
*/ |
12
|
|
|
class EncryptionAlgorithm extends Deg |
13
|
|
|
{ |
14
|
|
|
const TYPE_OSY = 2; |
15
|
|
|
|
16
|
|
|
const OPERATION_MODE_CBC = 2; |
17
|
|
|
const OPERATION_MODE_ISO_9796_1 = 16; |
18
|
|
|
const OPERATION_MODE_ISO_9796_2 = 17; |
19
|
|
|
const OPERATION_MODE_RSASSA_PKCS_RSAES_PKCS = 18; |
20
|
|
|
const OPERATION_MODE_RSASSA_PSS = 19; |
21
|
|
|
const OPERATION_MODE_999 = 999; |
22
|
|
|
|
23
|
|
|
const ALGORITHM_2_KEY_TRIPLE_DES = 13; |
24
|
|
|
const ALGORITHM_AES_256 = 14; |
25
|
|
|
const DEFAULT_ALGORITHM_IV = '@8@00000000'; |
26
|
|
|
|
27
|
|
|
const ALGORITHM_KEY_TYPE_SYM_SYM = 5; |
28
|
|
|
const ALGORITHM_KEY_TYPE_SYM_PUB = 6; |
29
|
|
|
const ALGORITHM_IV_DESCRIPTION_IVC = 1; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* EncryptionAlgorithm constructor. |
33
|
|
|
* |
34
|
|
|
* @param int $type |
35
|
|
|
* @param int $operationMode |
36
|
|
|
* @param int $algorithm |
37
|
|
|
* @param string $algorithmIv |
38
|
|
|
* @param int $algorithmKeyType |
39
|
|
|
* @param int $algorithmIvDescription |
40
|
|
|
*/ |
41
|
6 |
|
public function __construct( |
42
|
|
|
$type = self::TYPE_OSY, |
43
|
|
|
$operationMode = self::OPERATION_MODE_CBC, |
44
|
|
|
$algorithm = self::ALGORITHM_2_KEY_TRIPLE_DES, |
45
|
|
|
$algorithmIv = self::DEFAULT_ALGORITHM_IV, |
46
|
|
|
$algorithmKeyType = self::ALGORITHM_KEY_TYPE_SYM_SYM, |
47
|
|
|
$algorithmIvDescription = self::ALGORITHM_IV_DESCRIPTION_IVC |
48
|
|
|
) { |
49
|
6 |
|
$this->addDataElement($type); |
50
|
6 |
|
$this->addDataElement($operationMode); |
51
|
6 |
|
$this->addDataElement($algorithm); |
52
|
6 |
|
$this->addDataElement($algorithmIv); |
53
|
6 |
|
$this->addDataElement($algorithmKeyType); |
54
|
6 |
|
$this->addDataElement($algorithmIvDescription); |
55
|
6 |
|
} |
56
|
|
|
} |
57
|
|
|
|