Skip to content
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 generation support. #416

Draft
wants to merge 204 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 179 commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
4022c81
[sign] Define 'KeyPair' and impl key export
bal-e Oct 2, 2024
7b51569
[sign] Define trait 'Sign'
bal-e Oct 2, 2024
cb97321
[sign] Implement parsing from the DNS format
bal-e Oct 2, 2024
db51ae6
[sign] Provide some error information
bal-e Oct 2, 2024
a505415
[sign] Move 'KeyPair' to 'generic::SecretKey'
bal-e Oct 4, 2024
ea80694
[sign/generic] Add 'PublicKey'
bal-e Oct 7, 2024
7c94006
[sign] Rewrite the 'ring' module to use the 'Sign' trait
bal-e Oct 7, 2024
f9564c1
Implement DNSSEC signing with OpenSSL
bal-e Oct 9, 2024
c705428
[sign/openssl] Implement key generation
bal-e Oct 9, 2024
68476e7
[sign/openssl] Test key generation and import/export
bal-e Oct 9, 2024
b68b639
[sign/openssl] Add support for ECDSA
bal-e Oct 9, 2024
79b2a08
[sign/openssl] satisfy clippy
bal-e Oct 9, 2024
1aeeede
[sign/openssl] Implement the 'Sign' trait
bal-e Oct 9, 2024
90af63d
Install OpenSSL in CI builds
bal-e Oct 9, 2024
6370035
Ensure 'openssl' dep supports 3.x.x
bal-e Oct 9, 2024
d53f85a
[workflows/ci] Use 'vcpkg' instead of vendoring OpenSSL
bal-e Oct 9, 2024
5148bd3
Ensure 'openssl' dep exposes necessary interfaces
bal-e Oct 9, 2024
13bebd7
[workflows/ci] Record location of 'vcpkg'
bal-e Oct 9, 2024
c86f234
[workflows/ci] Use a YAML def for 'VCPKG_ROOT'
bal-e Oct 9, 2024
8939603
[workflows/ci] Fix a vcpkg triplet to use
bal-e Oct 9, 2024
9ed1f44
Upgrade openssl to 0.10.57 for bitflags 2.x
bal-e Oct 9, 2024
24b443c
[workflows/ci] Use dynamic linking for vcpkg openssl
bal-e Oct 9, 2024
d3a071d
[workflows/ci] Correctly annotate 'vcpkg'
bal-e Oct 9, 2024
669da93
[sign/openssl] Implement exporting public keys
bal-e Oct 9, 2024
8a0c59a
[sign/ring] Implement exporting public keys
bal-e Oct 9, 2024
7c6cde1
[sign/generic] Test (de)serialization for generic secret keys
bal-e Oct 9, 2024
d6a5313
[sign] Thoroughly test import/export in both backends
bal-e Oct 9, 2024
8321bbf
[sign] Remove debugging code and satisfy clippy
bal-e Oct 9, 2024
db6820e
[sign] Account for CR LF in tests
bal-e Oct 9, 2024
e7f9709
[sign/openssl] Fix bugs in the signing procedure
bal-e Oct 11, 2024
2663093
Initial NSEC3 generation support. Lacks collision detection and tests.
ximon18 Oct 15, 2024
bd31ebb
Clippy.
ximon18 Oct 15, 2024
bbf110f
TOOD -> TODO ;-)
ximon18 Oct 15, 2024
fbfbdea
Fix doctest failure.
ximon18 Oct 15, 2024
dba5a8a
Refactor the 'sign' module
bal-e Oct 15, 2024
b494f3c
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 15, 2024
25402ed
[sign] Define 'KeyPair' and impl key export
bal-e Oct 2, 2024
a62139a
[sign] Define trait 'Sign'
bal-e Oct 2, 2024
a4f2056
[sign] Implement parsing from the DNS format
bal-e Oct 2, 2024
f00a9ac
[sign] Provide some error information
bal-e Oct 2, 2024
6535747
[sign] Move 'KeyPair' to 'generic::SecretKey'
bal-e Oct 4, 2024
69e5066
[sign/generic] Add 'PublicKey'
bal-e Oct 7, 2024
3c80b2f
[sign] Rewrite the 'ring' module to use the 'Sign' trait
bal-e Oct 7, 2024
eace7b6
Implement DNSSEC signing with OpenSSL
bal-e Oct 9, 2024
c698403
[sign/openssl] Implement key generation
bal-e Oct 9, 2024
89dfdfc
[sign/openssl] Test key generation and import/export
bal-e Oct 9, 2024
4d912fb
[sign/openssl] Add support for ECDSA
bal-e Oct 9, 2024
24f6043
[sign/openssl] satisfy clippy
bal-e Oct 9, 2024
1b5d640
[sign/openssl] Implement the 'Sign' trait
bal-e Oct 9, 2024
fbafbf0
Install OpenSSL in CI builds
bal-e Oct 9, 2024
3358747
Ensure 'openssl' dep supports 3.x.x
bal-e Oct 9, 2024
e26b68d
[workflows/ci] Use 'vcpkg' instead of vendoring OpenSSL
bal-e Oct 9, 2024
c1f3178
Ensure 'openssl' dep exposes necessary interfaces
bal-e Oct 9, 2024
9c4f7b4
[workflows/ci] Record location of 'vcpkg'
bal-e Oct 9, 2024
2cae3cc
[workflows/ci] Use a YAML def for 'VCPKG_ROOT'
bal-e Oct 9, 2024
9ed98ed
[workflows/ci] Fix a vcpkg triplet to use
bal-e Oct 9, 2024
a1a5a0b
Upgrade openssl to 0.10.57 for bitflags 2.x
bal-e Oct 9, 2024
0b85a4f
[workflows/ci] Use dynamic linking for vcpkg openssl
bal-e Oct 9, 2024
e6bf6d9
[workflows/ci] Correctly annotate 'vcpkg'
bal-e Oct 9, 2024
2ab7178
[sign/openssl] Implement exporting public keys
bal-e Oct 9, 2024
d8c9b5f
[sign/ring] Implement exporting public keys
bal-e Oct 9, 2024
90ed936
[sign/generic] Test (de)serialization for generic secret keys
bal-e Oct 9, 2024
fff9595
[sign] Thoroughly test import/export in both backends
bal-e Oct 9, 2024
4c6aa4d
[sign] Remove debugging code and satisfy clippy
bal-e Oct 9, 2024
fe29593
[sign] Account for CR LF in tests
bal-e Oct 9, 2024
8536c4c
[sign/openssl] Fix bugs in the signing procedure
bal-e Oct 11, 2024
07b52ce
Refactor the 'sign' module
bal-e Oct 15, 2024
c419297
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 15, 2024
48c006c
[sign] Define 'KeyPair' and impl key export
bal-e Oct 2, 2024
66c8f4a
[sign] Define trait 'Sign'
bal-e Oct 2, 2024
b613705
[sign] Implement parsing from the DNS format
bal-e Oct 2, 2024
5e86496
[sign] Provide some error information
bal-e Oct 2, 2024
c33f6f6
[sign] Move 'KeyPair' to 'generic::SecretKey'
bal-e Oct 4, 2024
d2d0646
[sign/generic] Add 'PublicKey'
bal-e Oct 7, 2024
6dae3a1
[sign] Rewrite the 'ring' module to use the 'Sign' trait
bal-e Oct 7, 2024
4fccf7f
Implement DNSSEC signing with OpenSSL
bal-e Oct 9, 2024
0ae002f
[sign/openssl] Implement key generation
bal-e Oct 9, 2024
157a3b9
[sign/openssl] Test key generation and import/export
bal-e Oct 9, 2024
0a6e992
[sign/openssl] Add support for ECDSA
bal-e Oct 9, 2024
3a5d55b
[sign/openssl] satisfy clippy
bal-e Oct 9, 2024
a2d64b4
[sign/openssl] Implement the 'Sign' trait
bal-e Oct 9, 2024
ad69e1f
Install OpenSSL in CI builds
bal-e Oct 9, 2024
46f3f7f
Ensure 'openssl' dep supports 3.x.x
bal-e Oct 9, 2024
23ea439
[workflows/ci] Use 'vcpkg' instead of vendoring OpenSSL
bal-e Oct 9, 2024
b9fe3cb
Ensure 'openssl' dep exposes necessary interfaces
bal-e Oct 9, 2024
2469a78
[workflows/ci] Record location of 'vcpkg'
bal-e Oct 9, 2024
30951e8
[workflows/ci] Use a YAML def for 'VCPKG_ROOT'
bal-e Oct 9, 2024
174f0f4
[workflows/ci] Fix a vcpkg triplet to use
bal-e Oct 9, 2024
6add5c7
Upgrade openssl to 0.10.57 for bitflags 2.x
bal-e Oct 9, 2024
9395e44
[workflows/ci] Use dynamic linking for vcpkg openssl
bal-e Oct 9, 2024
67987c8
[workflows/ci] Correctly annotate 'vcpkg'
bal-e Oct 9, 2024
d4c6bdf
[sign/openssl] Implement exporting public keys
bal-e Oct 9, 2024
18d9a7d
[sign/ring] Implement exporting public keys
bal-e Oct 9, 2024
792cb9f
[sign/generic] Test (de)serialization for generic secret keys
bal-e Oct 9, 2024
306429b
[sign] Thoroughly test import/export in both backends
bal-e Oct 9, 2024
0c3fb8b
[sign] Remove debugging code and satisfy clippy
bal-e Oct 9, 2024
e2bb31d
[sign] Account for CR LF in tests
bal-e Oct 9, 2024
9820be2
[sign/openssl] Fix bugs in the signing procedure
bal-e Oct 11, 2024
94541da
Refactor the 'sign' module
bal-e Oct 15, 2024
c56b3fe
Move 'sign' and 'validate' to unstable feature gates
bal-e Oct 16, 2024
b2f0bbb
[workflows/ci] Document the vcpkg env vars
bal-e Oct 16, 2024
bbc3fb1
Rename public/secret key interfaces to '*Raw*'
bal-e Oct 16, 2024
1fc5309
[sign/ring] Store the RNG in an 'Arc'
bal-e Oct 16, 2024
2556e2a
[validate] Enhance 'Signature' API
bal-e Oct 16, 2024
b3b3f01
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 16, 2024
8086b45
[validate] Add high-level 'Key' type
bal-e Oct 16, 2024
ba774bb
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 16, 2024
6388387
[sign/openssl] Pad ECDSA keys when exporting
bal-e Oct 16, 2024
b2cfa7b
[validate] Implement 'Key::key_tag()'
bal-e Oct 16, 2024
e0344a6
[validate] Correct bit offsets for flags
bal-e Oct 16, 2024
f65c5cc
[validate] Implement support for digests
bal-e Oct 16, 2024
a0c2e4f
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 17, 2024
5ba8940
[sign] Define 'KeyPair' and impl key export
bal-e Oct 2, 2024
4c10381
[sign] Define trait 'Sign'
bal-e Oct 2, 2024
f33f775
[sign] Implement parsing from the DNS format
bal-e Oct 2, 2024
1d97597
[sign] Provide some error information
bal-e Oct 2, 2024
fa306e9
[sign] Move 'KeyPair' to 'generic::SecretKey'
bal-e Oct 4, 2024
56dec85
[sign/generic] Add 'PublicKey'
bal-e Oct 7, 2024
5f8e28f
[sign] Rewrite the 'ring' module to use the 'Sign' trait
bal-e Oct 7, 2024
46b67e9
Implement DNSSEC signing with OpenSSL
bal-e Oct 9, 2024
2451e1b
[sign/openssl] Implement key generation
bal-e Oct 9, 2024
159a94a
[sign/openssl] Test key generation and import/export
bal-e Oct 9, 2024
4fb6084
[sign/openssl] Add support for ECDSA
bal-e Oct 9, 2024
6bc9bce
[sign/openssl] satisfy clippy
bal-e Oct 9, 2024
be3e169
[sign/openssl] Implement the 'Sign' trait
bal-e Oct 9, 2024
836812a
Install OpenSSL in CI builds
bal-e Oct 9, 2024
66290a5
Ensure 'openssl' dep supports 3.x.x
bal-e Oct 9, 2024
2a1489f
[workflows/ci] Use 'vcpkg' instead of vendoring OpenSSL
bal-e Oct 9, 2024
e8d208f
Ensure 'openssl' dep exposes necessary interfaces
bal-e Oct 9, 2024
045d52b
[workflows/ci] Record location of 'vcpkg'
bal-e Oct 9, 2024
460679b
[workflows/ci] Use a YAML def for 'VCPKG_ROOT'
bal-e Oct 9, 2024
21ba8d3
[workflows/ci] Fix a vcpkg triplet to use
bal-e Oct 9, 2024
4195dd4
Upgrade openssl to 0.10.57 for bitflags 2.x
bal-e Oct 9, 2024
4f4f6ff
[workflows/ci] Use dynamic linking for vcpkg openssl
bal-e Oct 9, 2024
608cbea
[workflows/ci] Correctly annotate 'vcpkg'
bal-e Oct 9, 2024
632c1b0
[sign/openssl] Implement exporting public keys
bal-e Oct 9, 2024
4350d8b
[sign/ring] Implement exporting public keys
bal-e Oct 9, 2024
4c46552
[sign/generic] Test (de)serialization for generic secret keys
bal-e Oct 9, 2024
fc95523
[sign] Thoroughly test import/export in both backends
bal-e Oct 9, 2024
22e00a6
[sign] Remove debugging code and satisfy clippy
bal-e Oct 9, 2024
94b3e47
[sign] Account for CR LF in tests
bal-e Oct 9, 2024
68a5656
[sign/openssl] Fix bugs in the signing procedure
bal-e Oct 11, 2024
a71c339
Refactor the 'sign' module
bal-e Oct 15, 2024
824c8e3
Move 'sign' and 'validate' to unstable feature gates
bal-e Oct 16, 2024
6d8c29e
[workflows/ci] Document the vcpkg env vars
bal-e Oct 16, 2024
82a05aa
Rename public/secret key interfaces to '*Raw*'
bal-e Oct 16, 2024
980fe5a
[sign/ring] Store the RNG in an 'Arc'
bal-e Oct 16, 2024
35ff06c
[validate] Enhance 'Signature' API
bal-e Oct 16, 2024
95cc462
[validate] Add high-level 'Key' type
bal-e Oct 16, 2024
3cec8cb
[sign/openssl] Pad ECDSA keys when exporting
bal-e Oct 16, 2024
8682b6d
[validate] Implement 'Key::key_tag()'
bal-e Oct 16, 2024
57d20d9
[validate] Correct bit offsets for flags
bal-e Oct 16, 2024
f37c862
[validate] Implement support for digests
bal-e Oct 16, 2024
7f01a5f
[validate] Enhance BIND format conversion for 'Key'
bal-e Oct 18, 2024
b4103a3
[sign] Introduce 'SigningKey'
bal-e Oct 20, 2024
81720c3
[sign] Handle errors more responsibly
bal-e Oct 21, 2024
1e00479
[sign] correct doc link
bal-e Oct 21, 2024
d26a433
[sign/openssl] Replace panics with results
bal-e Oct 23, 2024
6968cb9
remove 'sign/key'
bal-e Oct 23, 2024
99cb9ef
[sign] Introduce 'common' for abstracting backends
bal-e Oct 24, 2024
8321d50
[sign/generic] add top-level doc comment
bal-e Oct 24, 2024
a25be56
[validate] debug bind format errors
bal-e Oct 24, 2024
59650a4
[validate] more debug statements
bal-e Oct 24, 2024
0f54a8d
[validate] format DNSKEYs using 'ZonefileFmt'
bal-e Oct 24, 2024
5a3de59
Reorganize crate features in 'Cargo.toml'
bal-e Oct 25, 2024
12a70af
[sign] Add key generation support for Ring
bal-e Oct 25, 2024
2f2fb58
[sign] Make OpenSSL support optional
bal-e Oct 25, 2024
735712c
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 28, 2024
a4316b5
[sign] Rename 'generic::SecretKey' to 'KeyBytes'
bal-e Oct 29, 2024
e0a4fc0
[sign] Rename 'SecretKey' to 'KeyPair' in all impls
bal-e Oct 29, 2024
31462cc
Merge branch 'main' into dnssec-key
bal-e Oct 29, 2024
4447cc6
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 29, 2024
48e178a
[sign] Rename 'KeyBytes' to 'SecretKeyBytes'
bal-e Oct 29, 2024
daa96d8
[validate] Rename 'RawPublicKey' to 'PublicKeyBytes'
bal-e Oct 29, 2024
d84e2c0
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 29, 2024
221f163
[sign/ring] Remove redundant imports
bal-e Oct 29, 2024
02c625b
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Oct 29, 2024
61bc3aa
[sign,validate] Add 'display_as_bind()' to key bytes types
bal-e Oct 30, 2024
55716a4
[sign,validate] remove unused imports
bal-e Oct 30, 2024
8bf2c9f
Move nsec3_hash() back into the validator module per review feedback.
ximon18 Oct 30, 2024
beb8e52
Move nsec3_hash() to the validate (not validator!) module per review …
ximon18 Oct 30, 2024
7831260
[sign] Document everything
bal-e Oct 31, 2024
a04c917
Extend test file with records useful for manual testing of NSEC3.
ximon18 Oct 28, 2024
abaab27
Revert "Extend test file with records useful for manual testing of NS…
ximon18 Oct 31, 2024
3c53e9e
Review feedback.
ximon18 Oct 31, 2024
50433f0
Review feedback.
ximon18 Oct 31, 2024
70e998a
Review feedback inspired change (though not actually what was suggest…
ximon18 Oct 31, 2024
7c9ee4c
[lib] Rewrite feature flag documentation
bal-e Nov 4, 2024
cea9ae3
[workflows/ci] Use 'apt-get' instead of 'apt'
bal-e Nov 4, 2024
354bf0a
[sign] Clarify documentation as per @ximon18
bal-e Nov 4, 2024
ca10361
[sign] Use 'secrecy' to protect private keys
bal-e Nov 4, 2024
9268dd3
Display NSEC3 without trailing space if the bitmap is empty.
ximon18 Nov 4, 2024
fb7e9ef
Backport NSEC3 improvements and upstream dnssec-key branch compatibil…
ximon18 Nov 4, 2024
414ea6c
[sign,validate] Add 'display_as_bind()' to key bytes types
bal-e Oct 30, 2024
2bde7aa
[sign,validate] remove unused imports
bal-e Oct 30, 2024
98db88b
[sign] Document everything
bal-e Oct 31, 2024
8877c22
Update to work with changes in the upstream dnssec-key branch using a…
ximon18 Nov 4, 2024
40d65ac
Minor tweaks.
ximon18 Nov 4, 2024
c0fc11b
Merge branch 'dnssec-key' into initial-nsec3-generation
ximon18 Nov 4, 2024
bdeddde
Add some Arbitrary impls to support cargo-fuzz based fuzz testing.
ximon18 Nov 6, 2024
f2cabc3
Impl Display for Nsec3HashError.
ximon18 Nov 6, 2024
109370d
Cargo fmt.
ximon18 Nov 6, 2024
e1c1db8
Merge branch 'main' into initial-nsec3-generation
ximon18 Nov 8, 2024
250b52e
Merge branch 'main' into initial-nsec3-generation
tertsdiepraam Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,28 @@ jobs:
rust: [1.76.0, stable, beta, nightly]
env:
RUSTFLAGS: "-D warnings"
# We use 'vcpkg' to install OpenSSL on Windows.
VCPKG_ROOT: "${{ github.workspace }}\\vcpkg"
VCPKGRS_TRIPLET: x64-windows-release
# Ensure that OpenSSL is dynamically linked.
VCPKGRS_DYNAMIC: 1
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}
- if: matrix.os == 'ubuntu-latest'
run: sudo apt install libssl-dev
- if: matrix.os == 'windows-latest'
id: vcpkg
uses: johnwason/vcpkg-action@v6
with:
pkgs: openssl
triplet: ${{ env.VCPKGRS_TRIPLET }}
token: ${{ github.token }}
github-binarycache: true
- if: matrix.rust == 'stable'
run: rustup component add clippy
- if: matrix.rust == 'stable'
Expand All @@ -37,6 +52,8 @@ jobs:
uses: hecrj/setup-rust-action@v2
with:
rust-version: "1.68.2"
- name: Install OpenSSL
run: sudo apt install libssl-dev
- name: Install nightly Rust
run: rustup install nightly
- name: Check with minimal-versions
Expand Down
66 changes: 66 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ heapless = { version = "0.8", optional = true }
libc = { version = "0.2.153", default-features = false, optional = true } # 0.2.79 is the first version that has IP_PMTUDISC_OMIT
parking_lot = { version = "0.12", optional = true }
moka = { version = "0.12.3", optional = true, features = ["future"] }
openssl = { version = "0.10.57", optional = true } # 0.10.57 upgrades to 'bitflags' 2.x
proc-macro2 = { version = "1.0.69", optional = true } # Force proc-macro2 to at least 1.0.69 for minimal-version build
ring = { version = "0.17", optional = true }
rustversion = { version = "1", optional = true }
Expand All @@ -47,24 +48,32 @@ tracing-subscriber = { version = "0.3.18", optional = true, features = ["env-fil

[features]
default = ["std", "rand"]

# Support for libraries
bytes = ["dep:bytes", "octseq/bytes"]
heapless = ["dep:heapless", "octseq/heapless"]
resolv = ["net", "smallvec", "unstable-client-transport"]
resolv-sync = ["resolv", "tokio/rt"]
serde = ["dep:serde", "octseq/serde"]
sign = ["std"]
smallvec = ["dep:smallvec", "octseq/smallvec"]
std = ["dep:hashbrown", "bytes?/std", "octseq/std", "time/std"]

# Cryptographic backends
ring = ["dep:ring"]
openssl = ["dep:openssl"]

# Crate features
resolv = ["net", "smallvec", "unstable-client-transport"]
resolv-sync = ["resolv", "tokio/rt"]
net = ["bytes", "futures-util", "rand", "std", "tokio"]
tsig = ["bytes", "ring", "smallvec"]
validate = ["bytes", "std", "ring"]
zonefile = ["bytes", "serde", "std"]

# Unstable features
unstable-client-transport = ["moka", "net", "tracing"]
unstable-server-transport = ["arc-swap", "chrono/clock", "libc", "net", "siphasher", "tracing"]
unstable-sign = ["std", "unstable-validate"]
unstable-stelline = ["tokio/test-util", "tracing", "tracing-subscriber", "tsig", "unstable-client-transport", "unstable-server-transport", "zonefile"]
unstable-validator = ["validate", "zonefile", "unstable-client-transport"]
unstable-validate = ["bytes", "std", "ring"]
unstable-validator = ["unstable-validate", "zonefile", "unstable-client-transport"]
unstable-xfr = ["net"]
unstable-zonetree = ["futures-util", "parking_lot", "rustversion", "serde", "std", "tokio", "tracing", "unstable-xfr", "zonefile"]

Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
#![cfg_attr(not(feature = "resolv"), doc = "* resolv:")]
//! An asynchronous DNS resolver based on the
//! [Tokio](https://tokio.rs/) async runtime.
#![cfg_attr(feature = "sign", doc = "* [sign]:")]
#![cfg_attr(not(feature = "sign"), doc = "* sign:")]
#![cfg_attr(feature = "unstable-sign", doc = "* [sign]:")]
#![cfg_attr(not(feature = "unstable-sign"), doc = "* sign:")]
//! Experimental support for DNSSEC signing.
#![cfg_attr(feature = "tsig", doc = "* [tsig]:")]
#![cfg_attr(not(feature = "tsig"), doc = "* tsig:")]
//! Support for securing DNS transactions with TSIG records.
#![cfg_attr(feature = "validate", doc = "* [validate]:")]
#![cfg_attr(not(feature = "validate"), doc = "* validate:")]
#![cfg_attr(feature = "unstable-validate", doc = "* [validate]:")]
#![cfg_attr(not(feature = "unstable-validate"), doc = "* validate:")]
//! Experimental support for DNSSEC validation.
#![cfg_attr(feature = "unstable-validator", doc = "* [validator]:")]
#![cfg_attr(not(feature = "unstable-validator"), doc = "* validator:")]
Expand Down Expand Up @@ -86,8 +86,8 @@
//! [ring](https://github.com/briansmith/ring) crate.
//! * `serde`: Enables serde serialization for a number of basic types.
//! * `sign`: basic DNSSEC signing support. This will enable the
#![cfg_attr(feature = "sign", doc = " [sign]")]
#![cfg_attr(not(feature = "sign"), doc = " sign")]
#![cfg_attr(feature = "unstable-sign", doc = " [sign]")]
#![cfg_attr(not(feature = "unstable-sign"), doc = " sign")]
//! module and requires the `std` feature. Note that this will not directly
//! enable actual signing. For that you will also need to pick a crypto
//! module via an additional feature. Currently we only support the `ring`
Expand All @@ -108,8 +108,8 @@
//! module and currently pulls in the
//! `bytes`, `ring`, and `smallvec` features.
//! * `validate`: basic DNSSEC validation support. This feature enables the
#![cfg_attr(feature = "validate", doc = " [validate]")]
#![cfg_attr(not(feature = "validate"), doc = " validate")]
#![cfg_attr(feature = "unstable-validate", doc = " [validate]")]
#![cfg_attr(not(feature = "unstable-validate"), doc = " validate")]
//! module and currently also enables the `std` and `ring`
//! features.
//! * `zonefile`: reading and writing of zonefiles. This feature enables the
Expand Down
37 changes: 37 additions & 0 deletions src/rdata/nsec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -453,6 +457,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>
Expand Down Expand Up @@ -496,6 +504,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(),
}
}
}

//--- OctetsFrom

impl<Octs, SrcOcts> OctetsFrom<Nsec3param<SrcOcts>> for Nsec3param<Octs>
Expand Down
Loading
Loading