1 | <?php |
||
22 | class RRSIG implements RdataInterface |
||
23 | { |
||
24 | 1 | use RdataTrait; |
|
25 | |||
26 | const TYPE = 'RRSIG'; |
||
27 | const TYPE_CODE = 46; |
||
28 | const TIME_FORMAT = 'YmdHis'; |
||
29 | |||
30 | /** |
||
31 | * The Type Covered field identifies the type of the RRset that is |
||
32 | * covered by this RRSIG record. E.G. A, MX, AAAA, etc. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $typeCovered; |
||
37 | |||
38 | /** |
||
39 | * The Algorithm field identifies the public key's cryptographic |
||
40 | * algorithm and determines the format of the Public Key field. |
||
41 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.2}. |
||
42 | * |
||
43 | * @var int |
||
44 | */ |
||
45 | private $algorithm; |
||
46 | |||
47 | /** |
||
48 | * The Labels field specifies the number of labels in the original RRSIG |
||
49 | * RR owner name. |
||
50 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.3}. |
||
51 | * |
||
52 | * @var int |
||
53 | */ |
||
54 | private $labels; |
||
55 | |||
56 | /** |
||
57 | * The Original TTL field specifies the TTL of the covered RRset as it |
||
58 | * appears in the authoritative zone. |
||
59 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.4}. |
||
60 | * |
||
61 | * @var int |
||
62 | */ |
||
63 | private $originalTtl; |
||
64 | |||
65 | /** |
||
66 | * 32-bit unsigned integer specifying the expiration date of a signature. |
||
67 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.5}. |
||
68 | * |
||
69 | * @var \DateTime |
||
70 | */ |
||
71 | private $signatureExpiration; |
||
72 | |||
73 | /** |
||
74 | * 32-bit unsigned integer specifying the inception date of a signature. |
||
75 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.5}. |
||
76 | * |
||
77 | * @var \DateTime |
||
78 | */ |
||
79 | private $signatureInception; |
||
80 | |||
81 | /** |
||
82 | * The Key Tag field contains the key tag value of the DNSKEY RR that |
||
83 | * validates this signature, in network byte order. |
||
84 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.6}. |
||
85 | * |
||
86 | * @var int |
||
87 | */ |
||
88 | private $keyTag; |
||
89 | |||
90 | /** |
||
91 | * The Signer's Name field value identifies the owner name of the DNSKEY\ |
||
92 | * RR that a validator is supposed to use to validate this signature. |
||
93 | * The Signer's Name field MUST contain the name of the zone of the |
||
94 | * covered RRset. |
||
95 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.7}. |
||
96 | * |
||
97 | * @var string |
||
98 | */ |
||
99 | private $signersName; |
||
100 | |||
101 | /** |
||
102 | * The Signature field contains the cryptographic signature that covers |
||
103 | * the RRSIG RDATA (excluding the Signature field) and the RRset |
||
104 | * specified by the RRSIG owner name, RRSIG class, and RRSIG Type |
||
105 | * Covered field. |
||
106 | * {@link https://tools.ietf.org/html/rfc4034#section-3.1.8}. |
||
107 | * |
||
108 | * @var string |
||
109 | */ |
||
110 | private $signature; |
||
111 | |||
112 | 5 | public function getTypeCovered(): string |
|
113 | { |
||
114 | 5 | return $this->typeCovered; |
|
115 | } |
||
116 | |||
117 | 17 | public function setTypeCovered(string $typeCovered): void |
|
118 | { |
||
119 | 17 | $this->typeCovered = $typeCovered; |
|
120 | 17 | } |
|
121 | |||
122 | 5 | public function getAlgorithm(): int |
|
126 | |||
127 | 17 | public function setAlgorithm(int $algorithm): void |
|
128 | { |
||
131 | |||
132 | 5 | public function getLabels(): int |
|
136 | |||
137 | 17 | public function setLabels(int $labels): void |
|
141 | |||
142 | 5 | public function getOriginalTtl(): int |
|
146 | |||
147 | 17 | public function setOriginalTtl(int $originalTtl): void |
|
151 | |||
152 | 5 | public function getSignatureExpiration(): \DateTime |
|
156 | |||
157 | 17 | public function setSignatureExpiration(\DateTime $signatureExpiration): void |
|
161 | |||
162 | 5 | public function getSignatureInception(): \DateTime |
|
166 | |||
167 | 17 | public function setSignatureInception(\DateTime $signatureInception): void |
|
171 | |||
172 | 5 | public function getKeyTag(): int |
|
176 | |||
177 | 17 | public function setKeyTag(int $keyTag): void |
|
181 | |||
182 | 5 | public function getSignersName(): string |
|
186 | |||
187 | 17 | public function setSignersName(string $signersName): void |
|
191 | |||
192 | 5 | public function getSignature(): string |
|
196 | |||
197 | 17 | public function setSignature(string $signature): void |
|
201 | |||
202 | 4 | public function toText(): string |
|
217 | |||
218 | /** |
||
219 | * @throws UnsupportedTypeException |
||
220 | */ |
||
221 | 1 | public function toWire(): string |
|
238 | |||
239 | 3 | public function fromText(string $text): void |
|
253 | |||
254 | /** |
||
255 | * @throws UnsupportedTypeException |
||
256 | */ |
||
257 | 1 | public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void |
|
282 | |||
283 | 4 | private static function makeDateTime(string $timeString): \DateTime |
|
292 | } |
||
293 |