1 | <?php |
||
23 | class CERT implements RdataInterface |
||
24 | { |
||
25 | 1 | use RdataTrait; |
|
26 | |||
27 | const TYPE = 'CERT'; |
||
28 | const TYPE_CODE = 37; |
||
29 | |||
30 | const KEY_TYPE_PKIX = 1; |
||
31 | const KEY_TYPE_SPKI = 2; |
||
32 | const KEY_TYPE_PGP = 3; |
||
33 | const KEY_TYPE_IPKIX = 4; |
||
34 | const KEY_TYPE_ISPKI = 5; |
||
35 | const KEY_TYPE_IPGP = 6; |
||
36 | const KEY_TYPE_ACPKIX = 7; |
||
37 | const KEY_TYPE_IACPKIX = 8; |
||
38 | const KEY_TYPE_URI = 253; |
||
39 | const KEY_TYPE_OID = 254; |
||
40 | |||
41 | const MNEMONICS = [ |
||
42 | self::KEY_TYPE_PKIX => 'PKIX', |
||
43 | self::KEY_TYPE_SPKI => 'SPKI', |
||
44 | self::KEY_TYPE_PGP => 'PGP', |
||
45 | self::KEY_TYPE_IPKIX => 'IPKIX', |
||
46 | self::KEY_TYPE_ISPKI => 'ISPKI', |
||
47 | self::KEY_TYPE_IPGP => 'IPGP', |
||
48 | self::KEY_TYPE_ACPKIX => 'ACPKIX', |
||
49 | self::KEY_TYPE_IACPKIX => 'IACPKIX', |
||
50 | self::KEY_TYPE_URI => 'URI', |
||
51 | self::KEY_TYPE_OID => 'OID', |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * @var int |
||
56 | */ |
||
57 | private $certificateType; |
||
58 | |||
59 | /** |
||
60 | * @var int |
||
61 | */ |
||
62 | private $keyTag; |
||
63 | |||
64 | /** |
||
65 | * @var int |
||
66 | */ |
||
67 | private $algorithm; |
||
68 | |||
69 | /** |
||
70 | * @var string |
||
71 | */ |
||
72 | private $certificate; |
||
73 | |||
74 | 1 | public function getCertificateType(): int |
|
78 | |||
79 | /** |
||
80 | * @param int|string $certificateType |
||
81 | * |
||
82 | * @throws InvalidArgumentException |
||
83 | */ |
||
84 | 4 | public function setCertificateType($certificateType): void |
|
94 | |||
95 | 1 | public function getKeyTag(): int |
|
99 | |||
100 | 4 | public function setKeyTag(int $keyTag): void |
|
104 | |||
105 | 1 | public function getAlgorithm(): int |
|
109 | |||
110 | /** |
||
111 | * @param string|int $algorithm |
||
112 | * |
||
113 | * @throws InvalidArgumentException |
||
114 | */ |
||
115 | 4 | public function setAlgorithm($algorithm): void |
|
125 | |||
126 | /** |
||
127 | * @param string $certificate Base64 encoded string |
||
128 | * |
||
129 | * @throws InvalidArgumentException |
||
130 | */ |
||
131 | 4 | public function setCertificate(string $certificate): void |
|
135 | |||
136 | /** |
||
137 | * @return string Base64 encoded string |
||
138 | */ |
||
139 | 1 | public function getCertificate(): string |
|
143 | |||
144 | 1 | public function toText(): string |
|
151 | |||
152 | 1 | public function toWire(): string |
|
156 | |||
157 | 1 | public function fromText(string $text): void |
|
165 | |||
166 | 1 | public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void |
|
180 | |||
181 | /** |
||
182 | 5 | * @throws InvalidArgumentException |
|
183 | */ |
||
184 | 5 | public static function getKeyTypeValue(string $keyTypeMnemonic): int |
|
192 | |||
193 | /** |
||
194 | * Get the associated mnemonic of a key type. |
||
195 | * |
||
196 | 1 | * @throws InvalidArgumentException |
|
197 | */ |
||
198 | 1 | public static function getKeyTypeMnemonic(int $keyTypeValue): string |
|
206 | } |
||
207 |