1 | <?php |
||
26 | abstract class AbstractDevice implements DeviceInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var BaseDerivationKeyFactory |
||
30 | */ |
||
31 | protected $bdkFactory; |
||
32 | |||
33 | /** |
||
34 | * @var KeySerialNumberFactory |
||
35 | */ |
||
36 | protected $ksnFactory; |
||
37 | |||
38 | /** |
||
39 | * @var InitialPinEncryptionKeyFactory |
||
40 | */ |
||
41 | protected $ipekFactory; |
||
42 | |||
43 | /** |
||
44 | * @var DerivedKeyFactory |
||
45 | */ |
||
46 | protected $derivedKeyFactory; |
||
47 | |||
48 | /** |
||
49 | * @var EncryptionHelperInterface |
||
50 | */ |
||
51 | protected $encryptionHelper; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $sessionKey; |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | 1 | public function __construct(DUKPTFactory $factory) |
|
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | 1 | public function load($hexBDK, $hexKSN) |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 1 | public function getSessionKey() |
|
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | 2 | public function decrypt($cipherText) |
|
105 | |||
106 | /** |
||
107 | * @return EncryptionHelperInterface |
||
108 | */ |
||
109 | abstract protected function createEncryptionHelper(); |
||
110 | |||
111 | /** |
||
112 | * @param DerivedKey $derivedKey |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | abstract protected function createSessionKey(DerivedKey $derivedKey); |
||
117 | |||
118 | /** |
||
119 | * Returns TRUE if the string has an even length. |
||
120 | * |
||
121 | * @param string $string |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | 2 | private function hasEvenLength($string) |
|
129 | } |
||
130 |