From 3eeac2cc1234bf2bbcc9cc9a924ed87d8d8ac4f3 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Fri, 4 Dec 2026 20:48:32 -0700 Subject: [PATCH] ssh-key v0.7.0 --- Cargo.lock | 7 +- ssh-key/CHANGELOG.md | 194 +++++++++++++++++++++++++++++++++++++--- ssh-key/Cargo.toml | 6 +- ssh-protocol/Cargo.toml | 2 +- 4 files changed, 193 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09621daa..9e92dd25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -237,9 +237,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eed333089e2e1c1ac8c6c0398e5e2497b4c9926ca6d0365ed1e099afa5bc23" +checksum = "94c1aa5a9b7626ed65ac0cf5ea9d4f1547af89017fbac20bd4de40022fff516f" dependencies = [ "cfg-if", "cpufeatures", @@ -875,12 +875,13 @@ dependencies = [ [[package]] name = "ssh-key" -version = "0.7.0-rc.13" +version = "0.7.0" dependencies = [ "argon2", "bcrypt-pbkdf", "chacha20", "ctutils", + "curve25519-dalek", "dsa", "ed25519-dalek", "getrandom", diff --git a/ssh-key/CHANGELOG.md b/ssh-key/CHANGELOG.md index 269258f5..ab49233d 100644 --- a/ssh-key/CHANGELOG.md +++ b/ssh-key/CHANGELOG.md @@ -4,21 +4,195 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 0.6.6 (2024-04-11) +## 0.7.0 (2026-12-04) ### Added -- impl `decode_as` for `KeypairData` ([#211]) +- Decode a certificate or public key after reading its algorithm name with + `Certificate::decode_as` and `public::KeyData::decode_as` ([#233]) +- Find, read, and write keys in a user's SSH directory with `DotSsh` under `std` ([#257], [#259]) +- Parse legacy `ssh-rsa` (RSA/SHA-1) signatures ([#263]) +- Serialize and deserialize `SshSig` with `serde`, using PEM for human-readable + formats and the SSH binary encoding for other formats ([#264]) +- Implement `core::error::Error` for `ssh_key::Error` in `no_std` builds ([#303]) +- Recognize the `rsa-sha2-256-cert-v01@openssh.com` and `rsa-sha2-512-cert-v01@openssh.com` + certificate algorithm names ([#311]) +- Verify and explicitly select legacy RSA/SHA-1 signatures with the `rsa` and `sha1` + features. The default RSA signer uses SHA-512 ([#315], [#323]) +- Read encrypted and unencrypted PuTTY PPK v2 and v3 private keys with + `PrivateKey::from_ppk` under the new `ppk` feature ([#324]) +- Implement `Hash` for `Fingerprint` ([#330]) +- Preserve non-UTF-8 comments in OpenSSH private keys ([#347]) +- Read and write OpenSSH public and private keys through `std::io::Read` and + `Write` with `read_openssh` and `write_openssh` ([#378]) +- Re-export `ssh-cipher` and `ssh-encoding` as `ssh_key::cipher` and `ssh_key::encoding` ([#379]) +- Sign and verify SSHSIG messages using a precomputed hash or a streaming digest with + the `*_prehash` and `*_digest` methods and `AssociatedHashAlg` ([#384], [#385]) +- Decode certificates embedded in public keys as `KeyData::Certificate`. Use + `certificate()` or `into_certificate()` to extract one ([#449]) +- Support `ssh-mldsa44-ed25519` composite keys, signatures, and certificates, + interoperable with OpenSSH 10.6 ([#583]) +- Support `ssh-mldsa87-p384` composite keys, signatures, and certificates from + `draft-ietf-sshm-composite-sigs-01` ([#654]) +- Generate keys, sign, and verify with either composite algorithm without `alloc`. + Enable them independently with `mldsa44-ed25519` and `mldsa87-p384` ([#655], [#661]) ### Changed -- clarify SSH vs OpenSSH formats ([#206]) +- Certificate validity timestamps use the full SSH `u64` range. The `valid_after_time` + and `valid_before_time` accessors now return `Option` ([#209]) +- P-521 signing uses deterministic nonces and no longer requires operating-system randomness ([#225]) +- RSA and DSA key components are private. Use their constructors and accessors in + place of struct literals and field access. RSA keys also expose `key_size()` ([#269], [#274], [#275]) +- Switch to Rust 2024 edition ([#354]) +- Move `Mpint` into `ssh-encoding` and retain the `ssh_key::Mpint` re-export ([#359]) +- Public and private key `comment()` accessors now require `alloc` and return `&Comment`. + Use `as_bytes()`, `as_str()`, or `as_str_lossy()` to select a representation ([#360]) +- Key encryption and KDF initialization accept fallible RNGs and report `Error::RngFailure` ([#362]) +- With `rsa` or `dsa` enabled, `Mpint` conversions use `encoding::Uint` + (`crypto_bigint::BoxedUint`) in place of `num_bigint_dig::BigUint` ([#362]) +- File-based key readers and writers accept `impl AsRef` ([#378], [#383]) +- The `std` feature no longer enables `std` in the underlying cryptographic backends ([#394]) +- Upgrade `rand_core` to v0.10, `sec1` to v0.8, and `sha1` and `sha2` to v0.11 ([#466], [#476], [#480], [#481]) +- Upgrade `bcrypt-pbkdf` to v0.11 and the `signature` traits to v3 ([#494], [#501]) +- Replace `subtle::ConstantTimeEq` implementations with `ctutils::CtEq` ([#507]) +- Upgrade `hmac` to v0.13 ([#519]) +- Report signature errors without an underlying `ssh_key::Error` as `Error::Signature` ([#523]) +- Upgrade `dsa` to v0.7, `ed25519-dalek` to v3, the NIST curve crates to v0.14, + and `argon2` to v0.6 ([#571], [#572], [#573], [#582]) +- Make `sha2` optional and enable it by default. With defaults disabled, enable + `sha2` for fingerprints and certificate validation. The SSHSIG digest and prehash + methods still work with an application-supplied SHA-2 implementation ([#602]) +- Raise the minimum supported Rust version from 1.65 to 1.87 ([#610]) +- Key and certificate `Decode` and `decode_as` implementations take `&mut Decoder` ([#618]) +- `Mpint` stores unsigned magnitudes of up to 16,384 bits. Decoding rejects negative + values and encoding writes canonical SSH integers ([#622]) +- Raise the default bcrypt-PBKDF cost for new encrypted OpenSSH keys from 16 to 32 rounds ([#624]) +- Reject decoded binary input larger than 128 MiB ([#628]) +- Limit certificates to 256 principals when building or decoding them ([#633]) +- Use `ssh-encoding`'s decoder constructors and derives for key types, preserving their + wire formats and validation ([#663], [#664], [#666]) +- Upgrade `ssh-encoding` and `ssh-cipher` to v0.4 ([#668], [#669]) -### Fixed -- fix `certificate::OptionsMap` encoding ([#207]) -- fixup `EcdsaPrivateKey` Debug impl ([#210]) +### Removed +- Remove the crate's separate 2,048-bit RSA minimum for generation and conversion. + Those operations now use the `rsa` backend's size policy ([#412]) +- Remove `Mpint::from_positive_bytes` and `as_positive_bytes`. Use `from_bytes` + and `as_bytes` for unsigned big-endian magnitudes ([#622]) -[#206]: https://github.com/RustCrypto/SSH/pull/206 -[#207]: https://github.com/RustCrypto/SSH/pull/207 -[#210]: https://github.com/RustCrypto/SSH/pull/210 -[#211]: https://github.com/RustCrypto/SSH/pull/211 +### Fixed +- Read OpenSSH private keys with an empty comment and no padding ([#216]) +- Preserve both distinct prime factors when converting an SSH keypair to an RSA private key ([#218]) +- Detect the Base64 line width when reading PEM-wrapped OpenSSH private keys ([#252]) +- Accept the extra padding PuTTYgen writes on unencrypted OpenSSH private keys ([#321]) +- Decode short P-521 private scalars ([#351]) +- Encode a certificate held in `KeyData` with its certificate algorithm name exactly once ([#451]) +- Handle OpenSSH's `u64::MAX` no-expiry sentinel in certificate system-time conversion ([#504]) +- Encode the flags and counter for `sk-ecdsa-sha2-nistp256@openssh.com` signatures + after the length-prefixed ECDSA signature ([#532]) +- Restore the `getrandom` feature and re-export the matching `getrandom` crate ([#539]) +- Accept repeated spaces, tabs, and leading whitespace in `known_hosts` entries ([#619]) +- Accept ECDSA private scalars as short as 24 bytes, padding them to the curve size ([#623]) +- Reject custom certificate algorithms with an empty name or domain ([#629]) +- Reject trailing bytes in `Signature::try_from(&[u8])` and binary `SshSig` + deserialization with `serde` ([#631]) +- Include the CRT coefficient `iqmp` when comparing RSA private keys ([#635]) + +### Security +- Reject certificates used as CA keys when decoding or signing certificates ([#604]) +- Require `ctutils` v0.4.8, which includes constant-time mask generation and + comparison fixes ([#610], [RUSTSEC-2026-0385]) +- Upgrade the optional `rsa` backend to v0.10, which fixes the upstream RSA + decryption timing issue ([#613], [RUSTSEC-2023-0071]) +- Check that bcrypt-PBKDF rounds are in `1..=1_048_576` when reading or writing the + KDF parameters and before deriving an OpenSSH encryption key ([#624], [#625]) +- Bound Argon2 parameters from PuTTY PPK files to 1 GiB of memory, 1,024 passes, + and 64 lanes before running the KDF ([#626]) +- Keep private key material out of PPK parse errors by omitting the input text ([#636]) +- Verify and re-encode certificates using the exact bytes signed by the CA. + This preserves valid signatures over noncanonical field encodings and rejects + changes to signed bytes that decode to the same value ([#659]) +- Raise the `curve25519-dalek` minimum to v5.1 for `ed25519` and `mldsa44-ed25519`. + This fixes an arithmetic error in the x86-64 AVX-512 backend ([RUSTSEC-2026-0620]) + +[#209]: https://github.com/RustCrypto/SSH/pull/209 +[#216]: https://github.com/RustCrypto/SSH/pull/216 +[#218]: https://github.com/RustCrypto/SSH/pull/218 +[#225]: https://github.com/RustCrypto/SSH/pull/225 +[#233]: https://github.com/RustCrypto/SSH/pull/233 +[#252]: https://github.com/RustCrypto/SSH/pull/252 +[#257]: https://github.com/RustCrypto/SSH/pull/257 +[#259]: https://github.com/RustCrypto/SSH/pull/259 +[#263]: https://github.com/RustCrypto/SSH/pull/263 +[#264]: https://github.com/RustCrypto/SSH/pull/264 +[#269]: https://github.com/RustCrypto/SSH/pull/269 +[#274]: https://github.com/RustCrypto/SSH/pull/274 +[#275]: https://github.com/RustCrypto/SSH/pull/275 +[#303]: https://github.com/RustCrypto/SSH/pull/303 +[#311]: https://github.com/RustCrypto/SSH/pull/311 +[#315]: https://github.com/RustCrypto/SSH/pull/315 +[#321]: https://github.com/RustCrypto/SSH/pull/321 +[#323]: https://github.com/RustCrypto/SSH/pull/323 +[#324]: https://github.com/RustCrypto/SSH/pull/324 +[#330]: https://github.com/RustCrypto/SSH/pull/330 +[#347]: https://github.com/RustCrypto/SSH/pull/347 +[#351]: https://github.com/RustCrypto/SSH/pull/351 +[#354]: https://github.com/RustCrypto/SSH/pull/354 +[#359]: https://github.com/RustCrypto/SSH/pull/359 +[#360]: https://github.com/RustCrypto/SSH/pull/360 +[#362]: https://github.com/RustCrypto/SSH/pull/362 +[#378]: https://github.com/RustCrypto/SSH/pull/378 +[#379]: https://github.com/RustCrypto/SSH/pull/379 +[#383]: https://github.com/RustCrypto/SSH/pull/383 +[#384]: https://github.com/RustCrypto/SSH/pull/384 +[#385]: https://github.com/RustCrypto/SSH/pull/385 +[#394]: https://github.com/RustCrypto/SSH/pull/394 +[#412]: https://github.com/RustCrypto/SSH/pull/412 +[#449]: https://github.com/RustCrypto/SSH/pull/449 +[#451]: https://github.com/RustCrypto/SSH/pull/451 +[#466]: https://github.com/RustCrypto/SSH/pull/466 +[#476]: https://github.com/RustCrypto/SSH/pull/476 +[#480]: https://github.com/RustCrypto/SSH/pull/480 +[#481]: https://github.com/RustCrypto/SSH/pull/481 +[#494]: https://github.com/RustCrypto/SSH/pull/494 +[#501]: https://github.com/RustCrypto/SSH/pull/501 +[#504]: https://github.com/RustCrypto/SSH/pull/504 +[#507]: https://github.com/RustCrypto/SSH/pull/507 +[#519]: https://github.com/RustCrypto/SSH/pull/519 +[#523]: https://github.com/RustCrypto/SSH/pull/523 +[#532]: https://github.com/RustCrypto/SSH/pull/532 +[#539]: https://github.com/RustCrypto/SSH/pull/539 +[#571]: https://github.com/RustCrypto/SSH/pull/571 +[#572]: https://github.com/RustCrypto/SSH/pull/572 +[#573]: https://github.com/RustCrypto/SSH/pull/573 +[#582]: https://github.com/RustCrypto/SSH/pull/582 +[#583]: https://github.com/RustCrypto/SSH/pull/583 +[#602]: https://github.com/RustCrypto/SSH/pull/602 +[#604]: https://github.com/RustCrypto/SSH/pull/604 +[#610]: https://github.com/RustCrypto/SSH/pull/610 +[#613]: https://github.com/RustCrypto/SSH/pull/613 +[#618]: https://github.com/RustCrypto/SSH/pull/618 +[#619]: https://github.com/RustCrypto/SSH/pull/619 +[#622]: https://github.com/RustCrypto/SSH/pull/622 +[#623]: https://github.com/RustCrypto/SSH/pull/623 +[#624]: https://github.com/RustCrypto/SSH/pull/624 +[#625]: https://github.com/RustCrypto/SSH/pull/625 +[#626]: https://github.com/RustCrypto/SSH/pull/626 +[#628]: https://github.com/RustCrypto/SSH/pull/628 +[#629]: https://github.com/RustCrypto/SSH/pull/629 +[#631]: https://github.com/RustCrypto/SSH/pull/631 +[#633]: https://github.com/RustCrypto/SSH/pull/633 +[#635]: https://github.com/RustCrypto/SSH/pull/635 +[#636]: https://github.com/RustCrypto/SSH/pull/636 +[#654]: https://github.com/RustCrypto/SSH/pull/654 +[#655]: https://github.com/RustCrypto/SSH/pull/655 +[#659]: https://github.com/RustCrypto/SSH/pull/659 +[#661]: https://github.com/RustCrypto/SSH/pull/661 +[#663]: https://github.com/RustCrypto/SSH/pull/663 +[#664]: https://github.com/RustCrypto/SSH/pull/664 +[#666]: https://github.com/RustCrypto/SSH/pull/666 +[#668]: https://github.com/RustCrypto/SSH/pull/668 +[#669]: https://github.com/RustCrypto/SSH/pull/669 +[RUSTSEC-2023-0071]: https://rustsec.org/advisories/RUSTSEC-2023-0071.html +[RUSTSEC-2026-0385]: https://rustsec.org/advisories/RUSTSEC-2026-0385.html +[RUSTSEC-2026-0620]: https://rustsec.org/advisories/RUSTSEC-2026-0620.html ## 0.6.7 (2024-10-15) ### Fixed diff --git a/ssh-key/Cargo.toml b/ssh-key/Cargo.toml index 87af53a1..201d3600 100644 --- a/ssh-key/Cargo.toml +++ b/ssh-key/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssh-key" -version = "0.7.0-rc.13" +version = "0.7.0" description = """ Pure Rust implementation of SSH key file format decoders/encoders as described in RFC4251/RFC4253 and OpenSSH key formats, as well as "sshsig" signatures and @@ -31,6 +31,8 @@ zeroize = { version = "1.9", default-features = false } # optional dependencies argon2 = { version = "0.6", optional = true, default-features = false, features = ["alloc"] } bcrypt-pbkdf = { version = "0.11", optional = true, default-features = false, features = ["alloc"] } +# ed25519-dalek 3.0.0 allows curve25519-dalek 5.0.0, affected by RUSTSEC-2026-0620. +curve25519-dalek = { version = "5.1", optional = true, default-features = false } dsa = { version = "0.7", optional = true, default-features = false, features = ["hazmat"] } ed25519-dalek = { version = "3", optional = true, default-features = false } hex = { version = "0.4", optional = true, default-features = false, features = ["alloc"] } @@ -59,7 +61,7 @@ std = ["alloc"] crypto = ["ed25519", "p256", "p384", "p521", "rsa"] # NOTE: `dsa` is obsolete/weak dsa = ["dep:dsa", "dep:sha1", "alloc", "encoding/bigint", "signature/rand_core"] ecdsa = ["dep:sec1"] -ed25519 = ["dep:ed25519-dalek", "rand_core", "sha2"] +ed25519 = ["dep:curve25519-dalek", "dep:ed25519-dalek", "rand_core", "sha2"] encryption = [ "dep:bcrypt-pbkdf", "alloc", diff --git a/ssh-protocol/Cargo.toml b/ssh-protocol/Cargo.toml index 830fa221..dcf9d3be 100644 --- a/ssh-protocol/Cargo.toml +++ b/ssh-protocol/Cargo.toml @@ -18,7 +18,7 @@ rust-version = "1.87" [dependencies] cipher = { package = "ssh-cipher", version = "0.4", default-features = false } encoding = { package = "ssh-encoding", version = "0.4", default-features = false } -key = { package = "ssh-key", version = "0.7.0-rc.13", default-features = false } +key = { package = "ssh-key", version = "0.7", default-features = false } [features] default = ["std"]