-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSEC3 and multiple key signing support. #416
base: main
Are you sure you want to change the base?
Changes from 250 commits
9607ba0
9325956
8c2b140
12c252f
e4a5bf9
b9f9b4a
ad795a9
33178c2
10193c7
5f6f7e7
254b52f
bc68b0b
c7f26ac
6b7321c
64da561
7503455
15b72c0
5c23fdb
c141bf9
660d2f2
8c583b5
8f97bd3
85ffaf7
254dc9c
2359531
f788ba5
dc79547
02f64a4
ca982a4
68d7141
200f0bb
31fabac
9c1cd42
80007c3
7f1bcb9
55c6975
99d4fcc
b92f2f4
69e8415
29cc4a1
9c82849
2a80b17
518b4d7
2a956f7
23031e5
605efe6
493e870
3320bc9
7ff0cf8
f7b9351
0a71293
529e6e6
0600feb
c0016c1
8ba17e9
931d134
54ab872
b17fb85
ed4fb30
9aa7f7c
d3b3da5
d124294
c93eae7
bb0945a
8aadb43
aeb6d93
c5c422d
2034f32
9cb5d8d
d863dba
d6a3f1d
398e70b
f00acc6
ae94056
f0d383e
3943d26
7deffd0
bd7f436
a9aa52c
8d53906
6586302
3319ec6
e4a3aec
1342d4c
29105f5
dd120bc
8af5518
222d862
427dd83
072cc4c
a98182b
8911c93
4ad8177
822c95a
4c96f94
ea56b58
40c678c
7165146
e0cd687
f6df4fb
340a70a
a4492ce
880f334
c90026d
03b70ca
844418e
35609cc
e663e65
b868b42
c2f1fbd
6162b72
28e2144
0dbeffb
79d5b91
e6d0844
33beefe
fc29943
2e761c1
ceab294
397ade4
ce3d52f
7e7d384
70a1894
b7a65c0
34f681a
5da1bb0
955d320
9e9baec
d45960f
51d5bed
ecf0f59
8d49648
174e694
7c3c995
af545ff
d5c31d7
681456a
b1f7a20
1056703
f563f32
5549ba7
f128a60
e8bbd08
3fc8c01
f945240
87ba5c6
faaa7db
d26d620
d7ee3c0
d134cca
55e333a
28623dd
d20e52e
1aef63f
bcac30c
bac2e8a
d23c1e8
2812600
8c2709a
1f75a00
ba144e9
e843da5
5a2959e
d22880a
f4899e1
495cc96
501ae94
2f415a8
d724fce
1db6220
e8375ee
78b48eb
5a82490
5dd9a6f
51f8352
2d961d3
73e1e78
6d61377
3644ca4
0ab6294
4fdf5a5
01e6b59
4f15520
b15fab6
6a17341
47760e8
0e71ecd
041c92f
b906e53
287576e
fb4f159
8b53b6c
0755ee0
dbd09b2
fe8fc8e
df72cb4
b4b7e91
9c6f866
6321f73
edc513b
3fc07c4
5fc894e
801fd2d
671da3b
48ec284
391d7dc
406818f
b281261
fdb5c66
e701add
c5cdf3c
5b4c4fe
294770d
614d815
f6c2ce5
94cf97d
8984921
019934c
ab40d90
0f7ca2b
e7d2460
976b83e
26911fd
0bd93ec
ffa16b3
3717c66
1887d7e
7764e6b
d807d4b
2f39e2f
56ce3b0
0680c1f
14cd78f
5efcccf
1660cba
13f8e51
4910b9b
6b6588c
1d950ae
01f542b
d311371
2d33877
3086e85
ae36053
1904364
3c0746a
72b7785
daa6159
f372c91
fcc94d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//! ZONEMD IANA parameters. | ||
|
||
//------------ ZonemdScheme -------------------------------------------------- | ||
|
||
int_enum! { | ||
/// ZONEMD schemes. | ||
/// | ||
/// This type selects the method by which data is collated and presented | ||
/// as input to the hashing function for use with [ZONEMD]. | ||
/// | ||
/// For the currently registered values see the [IANA registration]. This | ||
/// type is complete as of 2024-11-29. | ||
/// | ||
/// [ZONEMD]: ../../../rdata/zonemd/index.html | ||
/// [IANA registration]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#zonemd-schemes | ||
=> | ||
ZonemdScheme, u8; | ||
|
||
/// Specifies that the SIMPLE scheme is used. | ||
(SIMPLE => 1, "SIMPLE") | ||
} | ||
|
||
int_enum_str_decimal!(ZonemdScheme, u8); | ||
int_enum_zonefile_fmt_decimal!(ZonemdScheme, "scheme"); | ||
|
||
//------------ ZonemdAlg ----------------------------------------------------- | ||
|
||
int_enum! { | ||
/// ZONEMD algorithms. | ||
/// | ||
/// This type selects the algorithm used to hash domain names for use with | ||
/// the [ZONEMD]. | ||
/// | ||
/// For the currently registered values see the [IANA registration]. This | ||
/// type is complete as of 2024-11-29. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reword "complete" to "up-to-date"? "Complete" makes it sound like no more additions are expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was copied from existing |
||
/// | ||
/// [ZONEMD]: ../../../rdata/zonemd/index.html | ||
/// [IANA registration]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#zonemd-hash-algorithms | ||
=> | ||
ZonemdAlg, u8; | ||
|
||
/// Specifies that the SHA-384 algorithm is used. | ||
(SHA384 => 1, "SHA384") | ||
|
||
/// Specifies that the SHA-512 algorithm is used. | ||
(SHA512 => 2, "SHA512") | ||
Comment on lines
+42
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps the doc comments should be phrased as "Use the SHA-xxx algorithm." That would be consistent with other documentation (e.g. we document what a function does, not what it is). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was copied from existing |
||
} | ||
|
||
int_enum_str_decimal!(ZonemdAlg, u8); | ||
int_enum_zonefile_fmt_decimal!(ZonemdAlg, "hash algorithm"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,10 @@ impl<Octs> Nsec3<Octs> { | |
&self.next_owner | ||
} | ||
|
||
pub fn set_next_owner(&mut self, next_owner: OwnerHash<Octs>) { | ||
self.next_owner = next_owner; | ||
} | ||
|
||
pub fn types(&self) -> &RtypeBitmap<Octs> { | ||
&self.types | ||
} | ||
|
@@ -354,7 +358,10 @@ impl<Octs: AsRef<[u8]>> fmt::Display for Nsec3<Octs> { | |
self.hash_algorithm, self.flags, self.iterations, self.salt | ||
)?; | ||
base32::display_hex(&self.next_owner, f)?; | ||
write!(f, " {}", self.types) | ||
if !self.types.is_empty() { | ||
write!(f, " {}", self.types)?; | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
||
|
@@ -453,6 +460,10 @@ impl<Octs> Nsec3param<Octs> { | |
&self.salt | ||
} | ||
|
||
pub fn into_salt(self) -> Nsec3Salt<Octs> { | ||
self.salt | ||
} | ||
|
||
pub(super) fn convert_octets<Target>( | ||
self, | ||
) -> Result<Nsec3param<Target>, Target::Error> | ||
|
@@ -496,6 +507,35 @@ impl<Octs> Nsec3param<Octs> { | |
} | ||
} | ||
|
||
//--- Default | ||
|
||
impl<Octs> Default for Nsec3param<Octs> | ||
where | ||
Octs: From<&'static [u8]>, | ||
{ | ||
/// Best practice default values for NSEC3 hashing. | ||
/// | ||
/// Per [RFC 9276] section 3.1: | ||
/// | ||
/// - _SHA-1, no extra iterations, empty salt._ | ||
/// | ||
/// Per [RFC 5155] section 4.1.2: | ||
/// | ||
/// - _The Opt-Out flag is not used and is set to zero._ | ||
/// - _All other flags are reserved for future use, and must be zero._ | ||
/// | ||
/// [RFC 5155]: https://www.rfc-editor.org/rfc/rfc5155.html | ||
/// [RFC 9276]: https://www.rfc-editor.org/rfc/rfc9276.html | ||
fn default() -> Self { | ||
Self { | ||
hash_algorithm: Nsec3HashAlg::SHA1, | ||
flags: 0, | ||
iterations: 0, | ||
salt: Nsec3Salt::empty(), | ||
} | ||
} | ||
} | ||
Comment on lines
+576
to
+601
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely comfortable with the "best-practice" value being There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you make a good point. My intent was to provide good defaults. |
||
|
||
//--- OctetsFrom | ||
|
||
impl<Octs, SrcOcts> OctetsFrom<Nsec3param<SrcOcts>> for Nsec3param<Octs> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this more consistent between the
{ version = "..." }
and"..."
cases?