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

Loading, storing, and generating DNSSEC keys #406

Merged
merged 69 commits into from
Nov 5, 2024
Merged

Loading, storing, and generating DNSSEC keys #406

merged 69 commits into from
Nov 5, 2024

Commits on Oct 24, 2024

  1. [sign] Define 'KeyPair' and impl key export

    A private key converted into a 'KeyPair' can be exported in the
    conventional DNS format.  This is an important step in implementing
    'ldns-keygen' using 'domain'.  It is up to the implementation modules
    to provide conversion to and from 'KeyPair'; some impls (e.g. for HSMs)
    won't support it at all.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    5ba8940 View commit details
    Browse the repository at this point in the history
  2. [sign] Define trait 'Sign'

    'Sign' is a more generic version of 'sign::key::SigningKey' that does
    not provide public key information.  It does not try to abstract over
    all the functionality of a keypair, since that can depend on the
    underlying cryptographic implementation.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    4c10381 View commit details
    Browse the repository at this point in the history
  3. [sign] Implement parsing from the DNS format

    There are probably lots of bugs in this implementation, I'll add some
    tests soon.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    f33f775 View commit details
    Browse the repository at this point in the history
  4. [sign] Provide some error information

    Also fixes 'cargo clippy' issues, particularly with the MSRV.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    1d97597 View commit details
    Browse the repository at this point in the history
  5. [sign] Move 'KeyPair' to 'generic::SecretKey'

    I'm going to add a corresponding 'PublicKey' type, at which point it
    becomes important to differentiate from the generic representations and
    actual cryptographic implementations.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    fa306e9 View commit details
    Browse the repository at this point in the history
  6. [sign/generic] Add 'PublicKey'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    56dec85 View commit details
    Browse the repository at this point in the history
  7. [sign] Rewrite the 'ring' module to use the 'Sign' trait

    Key generation, for now, will only be provided by the OpenSSL backend
    (coming soon).  However, generic keys (for RSA/SHA-256 or Ed25519) can
    be imported into the Ring backend and used freely.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    5f8e28f View commit details
    Browse the repository at this point in the history
  8. Implement DNSSEC signing with OpenSSL

    The OpenSSL backend supports import from and export to generic secret
    keys, making the formatting and parsing machinery for them usable.  The
    next step is to implement generation of keys.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    46b67e9 View commit details
    Browse the repository at this point in the history
  9. [sign/openssl] Implement key generation

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    2451e1b View commit details
    Browse the repository at this point in the history
  10. [sign/openssl] Test key generation and import/export

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    159a94a View commit details
    Browse the repository at this point in the history
  11. [sign/openssl] Add support for ECDSA

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    4fb6084 View commit details
    Browse the repository at this point in the history
  12. [sign/openssl] satisfy clippy

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    6bc9bce View commit details
    Browse the repository at this point in the history
  13. [sign/openssl] Implement the 'Sign' trait

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    be3e169 View commit details
    Browse the repository at this point in the history
  14. Install OpenSSL in CI builds

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    836812a View commit details
    Browse the repository at this point in the history
  15. Ensure 'openssl' dep supports 3.x.x

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    66290a5 View commit details
    Browse the repository at this point in the history
  16. [workflows/ci] Use 'vcpkg' instead of vendoring OpenSSL

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    2a1489f View commit details
    Browse the repository at this point in the history
  17. Ensure 'openssl' dep exposes necessary interfaces

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    e8d208f View commit details
    Browse the repository at this point in the history
  18. [workflows/ci] Record location of 'vcpkg'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    045d52b View commit details
    Browse the repository at this point in the history
  19. [workflows/ci] Use a YAML def for 'VCPKG_ROOT'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    460679b View commit details
    Browse the repository at this point in the history
  20. [workflows/ci] Fix a vcpkg triplet to use

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    21ba8d3 View commit details
    Browse the repository at this point in the history
  21. Upgrade openssl to 0.10.57 for bitflags 2.x

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    4195dd4 View commit details
    Browse the repository at this point in the history
  22. [workflows/ci] Use dynamic linking for vcpkg openssl

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    4f4f6ff View commit details
    Browse the repository at this point in the history
  23. [workflows/ci] Correctly annotate 'vcpkg'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    608cbea View commit details
    Browse the repository at this point in the history
  24. [sign/openssl] Implement exporting public keys

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    632c1b0 View commit details
    Browse the repository at this point in the history
  25. [sign/ring] Implement exporting public keys

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    4350d8b View commit details
    Browse the repository at this point in the history
  26. [sign/generic] Test (de)serialization for generic secret keys

    There were bugs in the Base64 encoding/decoding that are not worth
    trying to debug; there's a perfectly usable Base64 implementation in
    the crate already.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    4c46552 View commit details
    Browse the repository at this point in the history
  27. [sign] Thoroughly test import/export in both backends

    I had to swap out the RSA key since 'ring' found it to be too small.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    fc95523 View commit details
    Browse the repository at this point in the history
  28. [sign] Remove debugging code and satisfy clippy

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    22e00a6 View commit details
    Browse the repository at this point in the history
  29. [sign] Account for CR LF in tests

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    94b3e47 View commit details
    Browse the repository at this point in the history
  30. [sign/openssl] Fix bugs in the signing procedure

    - RSA signatures were being made with an unspecified padding scheme.
    - ECDSA signatures were being output in ASN.1 DER format, instead of
      the fixed-size format required by DNSSEC (and output by 'ring').
    - Tests for signature failures are now added for both backends.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    68a5656 View commit details
    Browse the repository at this point in the history
  31. Refactor the 'sign' module

    Most functions have been renamed.  The public key types have been moved
    to the 'validate' module (which 'sign' now depends on), and they have
    been outfitted with conversions (e.g. to and from DNSKEY records).
    
    Importing a generic key into an OpenSSL or Ring key now requires the
    public key to also be available.  In both implementations, the pair are
    checked for consistency -- this ensures that both are uncorrupted and
    that keys have not been mixed up.  This also allows the Ring backend to
    support ECDSA keys (although key generation is still difficult).
    
    The 'PublicKey' and 'PrivateKey' enums now store their array data in
    'Box'.  This has two benefits: it is easier to securely manage memory
    on the heap (since the compiler will not copy it around the stack); and
    the smaller sizes of the types is beneficial (although negligibly) to
    performance.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    a71c339 View commit details
    Browse the repository at this point in the history
  32. Move 'sign' and 'validate' to unstable feature gates

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    824c8e3 View commit details
    Browse the repository at this point in the history
  33. [workflows/ci] Document the vcpkg env vars

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    6d8c29e View commit details
    Browse the repository at this point in the history
  34. Rename public/secret key interfaces to '*Raw*'

    This makes space for higher-level interfaces which track DNSKEY flags
    information (and possibly key rollover information).
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    82a05aa View commit details
    Browse the repository at this point in the history
  35. [sign/ring] Store the RNG in an 'Arc'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    980fe5a View commit details
    Browse the repository at this point in the history
  36. [validate] Enhance 'Signature' API

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    35ff06c View commit details
    Browse the repository at this point in the history
  37. [validate] Add high-level 'Key' type

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    95cc462 View commit details
    Browse the repository at this point in the history
  38. [sign/openssl] Pad ECDSA keys when exporting

    Tests would spuriously fail when generated keys were only 31 bytes in
    size.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    3cec8cb View commit details
    Browse the repository at this point in the history
  39. [validate] Implement 'Key::key_tag()'

    This is more efficient than allocating a DNSKEY record and computing
    the key tag there.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    8682b6d View commit details
    Browse the repository at this point in the history
  40. [validate] Correct bit offsets for flags

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    57d20d9 View commit details
    Browse the repository at this point in the history
  41. [validate] Implement support for digests

    The test keys have been rotated and replaced with KSKs since they have
    associated DS records I can verify digests against.  I also expanded
    Ring's testing to include ECDSA keys.  The validate module tests SHA-1
    keys as well, which aren't supported by 'sign'.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    f37c862 View commit details
    Browse the repository at this point in the history
  42. [validate] Enhance BIND format conversion for 'Key'

    Public keys in the BIND format can now have multiple lines (even with
    comments).  Keys can also be directly written into the BIND format and
    round-trips to and from the BIND format are now tested.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    7f01a5f View commit details
    Browse the repository at this point in the history
  43. [sign] Introduce 'SigningKey'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    b4103a3 View commit details
    Browse the repository at this point in the history
  44. [sign] Handle errors more responsibly

    The 'openssl' and 'ring' modules should now follow the contributing
    guidelines regarding module layout and formatting.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    81720c3 View commit details
    Browse the repository at this point in the history
  45. [sign] correct doc link

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    1e00479 View commit details
    Browse the repository at this point in the history
  46. [sign/openssl] Replace panics with results

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    d26a433 View commit details
    Browse the repository at this point in the history
  47. remove 'sign/key'

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    6968cb9 View commit details
    Browse the repository at this point in the history
  48. [sign] Introduce 'common' for abstracting backends

    This is useful for abstracting over OpenSSL and Ring, so that Ring can
    be used whenever possible while OpenSSL is used as a fallback.  This is
    useful for clients that just wish to support everything.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    99cb9ef View commit details
    Browse the repository at this point in the history
  49. [sign/generic] add top-level doc comment

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    8321d50 View commit details
    Browse the repository at this point in the history
  50. [validate] debug bind format errors

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    a25be56 View commit details
    Browse the repository at this point in the history
  51. [validate] more debug statements

    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    59650a4 View commit details
    Browse the repository at this point in the history
  52. [validate] format DNSKEYs using 'ZonefileFmt'

    The 'Dnskey' impl of 'fmt::Display' was no longer accurate to the zone
    file format because 'SecAlg' now prints '<code>(<mnemonic>)'.
    arya dradjica committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    0f54a8d View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2024

  1. Reorganize crate features in 'Cargo.toml'

    arya dradjica committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    5a3de59 View commit details
    Browse the repository at this point in the history
  2. [sign] Add key generation support for Ring

    It's a bit hacky because it relies on specific byte indices within the
    generated PKCS8 documents (internally, Ring basically just concatenates
    bytes to form the documents, and we use the same indices).  However,
    any change to the document format should be caught by the tests here.
    arya dradjica committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    12a70af View commit details
    Browse the repository at this point in the history
  3. [sign] Make OpenSSL support optional

    Now that Ring and OpenSSL support all mandatory algorithms, OpenSSL is
    no longer required in order to provide signing functionality.
    arya dradjica committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    2f2fb58 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2024

  1. [sign] Rename 'generic::SecretKey' to 'KeyBytes'

    arya dradjica committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    a4316b5 View commit details
    Browse the repository at this point in the history
  2. [sign] Rename 'SecretKey' to 'KeyPair' in all impls

    arya dradjica committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    e0a4fc0 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'main' into dnssec-key

    arya dradjica committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    31462cc View commit details
    Browse the repository at this point in the history
  4. [sign] Rename 'KeyBytes' to 'SecretKeyBytes'

    For consistency with the upcoming 'PublicKeyBytes'.
    arya dradjica committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    48e178a View commit details
    Browse the repository at this point in the history
  5. [validate] Rename 'RawPublicKey' to 'PublicKeyBytes'

    arya dradjica committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    daa96d8 View commit details
    Browse the repository at this point in the history
  6. [sign/ring] Remove redundant imports

    arya dradjica committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    221f163 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2024

  1. [sign,validate] Add 'display_as_bind()' to key bytes types

    arya dradjica committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    61bc3aa View commit details
    Browse the repository at this point in the history
  2. [sign,validate] remove unused imports

    arya dradjica committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    55716a4 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2024

  1. [sign] Document everything

    arya dradjica committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    7831260 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2024

  1. [lib] Rewrite feature flag documentation

    arya dradjica committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    7c9ee4c View commit details
    Browse the repository at this point in the history
  2. [workflows/ci] Use 'apt-get' instead of 'apt'

    arya dradjica committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    cea9ae3 View commit details
    Browse the repository at this point in the history
  3. [sign] Clarify documentation as per @ximon18

    arya dradjica committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    354bf0a View commit details
    Browse the repository at this point in the history
  4. [sign] Use 'secrecy' to protect private keys

    arya dradjica committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    ca10361 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2024

  1. [sign] Improve documentation and examples

    arya dradjica committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    01104f3 View commit details
    Browse the repository at this point in the history