|
1
|
|
|
<?php
|
|
2
|
|
|
|
|
3
|
|
|
/*
|
|
4
|
|
|
* This file is part of Badcow DNS Library.
|
|
5
|
|
|
*
|
|
6
|
|
|
* (c) Samuel Williams <[email protected]>
|
|
7
|
|
|
*
|
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
9
|
|
|
* file that was distributed with this source code.
|
|
10
|
|
|
*/
|
|
11
|
|
|
|
|
12
|
|
|
namespace Badcow\DNS\Rdata\DNSSEC;
|
|
13
|
|
|
|
|
14
|
|
|
use Badcow\DNS\Rdata\RdataInterface;
|
|
15
|
|
|
use Badcow\DNS\Rdata\RdataTrait;
|
|
16
|
|
|
|
|
17
|
|
|
class RRSIG implements RdataInterface
|
|
18
|
|
|
{
|
|
19
|
|
|
use RdataTrait;
|
|
20
|
|
|
|
|
21
|
|
|
const TYPE = 'RRSIG';
|
|
22
|
|
|
|
|
23
|
|
|
/**
|
|
24
|
|
|
* The Type Covered field identifies the type of the RRset that is
|
|
25
|
|
|
* covered by this RRSIG record. E.G. A, MX, AAAA, etc.
|
|
26
|
|
|
*
|
|
27
|
|
|
* @var string
|
|
28
|
|
|
*/
|
|
29
|
|
|
private $typeCovered;
|
|
30
|
|
|
|
|
31
|
|
|
/**
|
|
32
|
|
|
* The Algorithm field identifies the public key's cryptographic
|
|
33
|
|
|
* algorithm and determines the format of the Public Key field.
|
|
34
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.2}
|
|
35
|
|
|
*
|
|
36
|
|
|
* @var int
|
|
37
|
|
|
*/
|
|
38
|
|
|
private $algorithm;
|
|
39
|
|
|
|
|
40
|
|
|
/**
|
|
41
|
|
|
* The Labels field specifies the number of labels in the original RRSIG
|
|
42
|
|
|
* RR owner name.
|
|
43
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.3}
|
|
44
|
|
|
*
|
|
45
|
|
|
* @var
|
|
46
|
|
|
*/
|
|
47
|
|
|
private $labels;
|
|
48
|
|
|
|
|
49
|
|
|
/**
|
|
50
|
|
|
* The Original TTL field specifies the TTL of the covered RRset as it
|
|
51
|
|
|
* appears in the authoritative zone.
|
|
52
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.4}
|
|
53
|
|
|
*
|
|
54
|
|
|
* @var int
|
|
55
|
|
|
*/
|
|
56
|
|
|
private $originalTtl;
|
|
57
|
|
|
|
|
58
|
|
|
/**
|
|
59
|
|
|
* 32-bit unsigned integer specifying the expiration date of a signature.
|
|
60
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.5}
|
|
61
|
|
|
*
|
|
62
|
|
|
* @var int
|
|
63
|
|
|
*/
|
|
64
|
|
|
private $signatureExpiration;
|
|
65
|
|
|
|
|
66
|
|
|
/**
|
|
67
|
|
|
* 32-bit unsigned integer specifying the inception date of a signature.
|
|
68
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.5}
|
|
69
|
|
|
*
|
|
70
|
|
|
* @var int
|
|
71
|
|
|
*/
|
|
72
|
|
|
private $signatureInception;
|
|
73
|
|
|
|
|
74
|
|
|
/**
|
|
75
|
|
|
* The Key Tag field contains the key tag value of the DNSKEY RR that
|
|
76
|
|
|
* validates this signature, in network byte order.
|
|
77
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.6}
|
|
78
|
|
|
*
|
|
79
|
|
|
* @var int
|
|
80
|
|
|
*/
|
|
81
|
|
|
private $keyTag;
|
|
82
|
|
|
|
|
83
|
|
|
/**
|
|
84
|
|
|
* The Signer's Name field value identifies the owner name of the DNSKEY\
|
|
85
|
|
|
* RR that a validator is supposed to use to validate this signature.
|
|
86
|
|
|
* The Signer's Name field MUST contain the name of the zone of the
|
|
87
|
|
|
* covered RRset.
|
|
88
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.7}
|
|
89
|
|
|
*
|
|
90
|
|
|
* @var string
|
|
91
|
|
|
*/
|
|
92
|
|
|
private $signersName;
|
|
93
|
|
|
|
|
94
|
|
|
/**
|
|
95
|
|
|
* The Signature field contains the cryptographic signature that covers
|
|
96
|
|
|
* the RRSIG RDATA (excluding the Signature field) and the RRset
|
|
97
|
|
|
* specified by the RRSIG owner name, RRSIG class, and RRSIG Type
|
|
98
|
|
|
* Covered field.
|
|
99
|
|
|
* {@link https://tools.ietf.org/html/rfc4034#section-3.1.8}
|
|
100
|
|
|
*
|
|
101
|
|
|
* @var string
|
|
102
|
|
|
*/
|
|
103
|
|
|
private $signature;
|
|
104
|
|
|
|
|
105
|
|
|
/**
|
|
106
|
|
|
* @return string
|
|
107
|
|
|
*/
|
|
108
|
|
|
public function getTypeCovered()
|
|
109
|
|
|
{
|
|
110
|
|
|
return $this->typeCovered;
|
|
111
|
|
|
}
|
|
112
|
|
|
|
|
113
|
|
|
/**
|
|
114
|
|
|
* @param string $typeCovered
|
|
115
|
|
|
*/
|
|
116
|
|
|
public function setTypeCovered($typeCovered)
|
|
117
|
|
|
{
|
|
118
|
|
|
$this->typeCovered = $typeCovered;
|
|
119
|
|
|
}
|
|
120
|
|
|
|
|
121
|
|
|
/**
|
|
122
|
|
|
* @return int
|
|
123
|
|
|
*/
|
|
124
|
|
|
public function getAlgorithm()
|
|
125
|
|
|
{
|
|
126
|
|
|
return $this->algorithm;
|
|
127
|
|
|
}
|
|
128
|
|
|
|
|
129
|
|
|
/**
|
|
130
|
|
|
* @param int $algorithm
|
|
131
|
|
|
*/
|
|
132
|
|
|
public function setAlgorithm($algorithm)
|
|
133
|
|
|
{
|
|
134
|
|
|
$this->algorithm = $algorithm;
|
|
135
|
|
|
}
|
|
136
|
|
|
|
|
137
|
|
|
/**
|
|
138
|
|
|
* @return mixed
|
|
139
|
|
|
*/
|
|
140
|
|
|
public function getLabels()
|
|
141
|
|
|
{
|
|
142
|
|
|
return $this->labels;
|
|
143
|
|
|
}
|
|
144
|
|
|
|
|
145
|
|
|
/**
|
|
146
|
|
|
* @param mixed $labels
|
|
147
|
|
|
*/
|
|
148
|
|
|
public function setLabels($labels)
|
|
149
|
|
|
{
|
|
150
|
|
|
$this->labels = $labels;
|
|
151
|
|
|
}
|
|
152
|
|
|
|
|
153
|
|
|
/**
|
|
154
|
|
|
* @return int
|
|
155
|
|
|
*/
|
|
156
|
|
|
public function getOriginalTtl()
|
|
157
|
|
|
{
|
|
158
|
|
|
return $this->originalTtl;
|
|
159
|
|
|
}
|
|
160
|
|
|
|
|
161
|
|
|
/**
|
|
162
|
|
|
* @param int $originalTtl
|
|
163
|
|
|
*/
|
|
164
|
|
|
public function setOriginalTtl($originalTtl)
|
|
165
|
|
|
{
|
|
166
|
|
|
$this->originalTtl = $originalTtl;
|
|
167
|
|
|
}
|
|
168
|
|
|
|
|
169
|
|
|
/**
|
|
170
|
|
|
* @return int
|
|
171
|
|
|
*/
|
|
172
|
|
|
public function getSignatureExpiration()
|
|
173
|
|
|
{
|
|
174
|
|
|
return $this->signatureExpiration;
|
|
175
|
|
|
}
|
|
176
|
|
|
|
|
177
|
|
|
/**
|
|
178
|
|
|
* @param int $signatureExpiration
|
|
179
|
|
|
*/
|
|
180
|
|
|
public function setSignatureExpiration($signatureExpiration)
|
|
181
|
|
|
{
|
|
182
|
|
|
$this->signatureExpiration = $signatureExpiration;
|
|
183
|
|
|
}
|
|
184
|
|
|
|
|
185
|
|
|
/**
|
|
186
|
|
|
* @return int
|
|
187
|
|
|
*/
|
|
188
|
|
|
public function getSignatureInception()
|
|
189
|
|
|
{
|
|
190
|
|
|
return $this->signatureInception;
|
|
191
|
|
|
}
|
|
192
|
|
|
|
|
193
|
|
|
/**
|
|
194
|
|
|
* @param int $signatureInception
|
|
195
|
|
|
*/
|
|
196
|
|
|
public function setSignatureInception($signatureInception)
|
|
197
|
|
|
{
|
|
198
|
|
|
$this->signatureInception = $signatureInception;
|
|
199
|
|
|
}
|
|
200
|
|
|
|
|
201
|
|
|
/**
|
|
202
|
|
|
* @return int
|
|
203
|
|
|
*/
|
|
204
|
|
|
public function getKeyTag()
|
|
205
|
|
|
{
|
|
206
|
|
|
return $this->keyTag;
|
|
207
|
|
|
}
|
|
208
|
|
|
|
|
209
|
|
|
/**
|
|
210
|
|
|
* @param int $keyTag
|
|
211
|
|
|
*/
|
|
212
|
|
|
public function setKeyTag($keyTag)
|
|
213
|
|
|
{
|
|
214
|
|
|
$this->keyTag = $keyTag;
|
|
215
|
|
|
}
|
|
216
|
|
|
|
|
217
|
|
|
/**
|
|
218
|
|
|
* @return string
|
|
219
|
|
|
*/
|
|
220
|
|
|
public function getSignersName()
|
|
221
|
|
|
{
|
|
222
|
|
|
return $this->signersName;
|
|
223
|
|
|
}
|
|
224
|
|
|
|
|
225
|
|
|
/**
|
|
226
|
|
|
* @param string $signersName
|
|
227
|
|
|
*/
|
|
228
|
|
|
public function setSignersName($signersName)
|
|
229
|
|
|
{
|
|
230
|
|
|
$this->signersName = $signersName;
|
|
231
|
|
|
}
|
|
232
|
|
|
|
|
233
|
|
|
/**
|
|
234
|
|
|
* @return string
|
|
235
|
|
|
*/
|
|
236
|
|
|
public function getSignature()
|
|
237
|
|
|
{
|
|
238
|
|
|
return $this->signature;
|
|
239
|
|
|
}
|
|
240
|
|
|
|
|
241
|
|
|
/**
|
|
242
|
|
|
* @param string $signature
|
|
243
|
|
|
*/
|
|
244
|
|
|
public function setSignature($signature)
|
|
245
|
|
|
{
|
|
246
|
|
|
$this->signature = $signature;
|
|
247
|
|
|
}
|
|
248
|
|
|
|
|
249
|
|
|
/**
|
|
250
|
|
|
* {@inheritdoc}
|
|
251
|
|
|
*/
|
|
252
|
|
|
public function output()
|
|
253
|
|
|
{
|
|
254
|
|
|
return sprintf(
|
|
255
|
|
|
'%s %s %s %s %s %s %s %s %s',
|
|
256
|
|
|
$this->typeCovered,
|
|
257
|
|
|
$this->algorithm,
|
|
258
|
|
|
$this->labels,
|
|
259
|
|
|
$this->originalTtl,
|
|
260
|
|
|
$this->signatureExpiration,
|
|
261
|
|
|
$this->signatureInception,
|
|
262
|
|
|
$this->keyTag,
|
|
263
|
|
|
$this->signersName,
|
|
264
|
|
|
$this->signature
|
|
265
|
|
|
);
|
|
266
|
|
|
}
|
|
267
|
|
|
} |