# Changelog
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.4.0 (2026-12-04)
### Added
- `Decoder<R>` for bounded, nested decoding without allocation. Use `read_nested` for a
known length or `read_prefixed` for an SSH length prefix ([#618])
- `Mpint::is_zero` and equality comparisons for `Mpint` without the `ctutils` feature ([#622])
- `MpintRef` for encoding a borrowed magnitude, `Decoder::read_mpint_bytes` for decoding into
caller-provided storage, and a `Writer` impl for `&mut [u8]` ([#656])
- `Decoder::from_bytes`, `from_base64`, and `from_pem`. The `base64` and `pem` features
expose `Base64Decoder` and `PemDecoder` aliases. Use `pem_label()` to inspect the PEM label
or `pem::PemReader` to access the reader directly ([#663])
- With the `derive` feature, use `#[ssh(error = crate::Error)]` to select a derived
`Decode::Error` ([#665])
### Changed
- Raise the minimum supported Rust version from 1.85 to 1.87 ([#610])
- Limit `Mpint` magnitudes to 16384 bits (2048 bytes) ([#615])
- `Decode::decode` now takes `&mut Decoder<impl Reader>`. Call nested reads and completion
checks on the decoder. After a read or nested decode fails, subsequent reads return
`Error::Failed` ([#618])
- `Mpint::from_bytes` and `as_bytes` now use unsigned big-endian magnitudes. Decoding rejects
negative wire values and accepts redundant leading zeros within the wire-size limit.
Encoding produces canonical SSH integers. Use `TryFrom` to convert a `Uint` to an `Mpint`
and `From` for the reverse conversion ([#622])
- Report buffer reservation failures as `Error::Alloc` when decoding owned values or
encoding into a `Vec<u8>` ([#627])
- `Decoder::new` and `Reader::into_decoder` are fallible and reject decoded binary input
larger than 128 MiB, including when reading Base64 or PEM ([#628])
- Decode any SSH `uint32` representable as a `usize`, lifting the previous `0xfffff` cap ([#637])
- Accept SSH algorithm and method labels up to 64 bytes, up from 48 ([#639])
- Limit decoding to 64 active nested scopes and return `Error::NestingDepth` at the next level ([#641])
- The derives now reject previously ignored `#[ssh(...)]` attributes on enum variants ([#644])
- Custom `Reader` implementations must implement `Clone`. Each clone starts at the same
position and advances independently, allowing a decoder to reread the original bytes ([#659])
- Update the optional `ssh-derive` dependency to v0.4 ([#667])
### Removed
- `Mpint::from_positive_bytes`, `as_positive_bytes`, and `is_positive`. Use `from_bytes` and
`as_bytes` for unsigned magnitudes and `is_zero` to test for zero ([#622])
- `Reader::read_byten`. Use `Decoder::read_string_bytes` for a length-prefixed SSH string
or decode `[u8; N]` for a fixed-width byte array ([#647])
### Fixed
- Slice readers now return `Error::TrailingData` when a length-prefixed field is only partly
consumed ([8cbd2a0])
- Order `Mpint` values numerically with `ctutils` enabled and preserve canonical zero after
zeroization ([#622])
- Count four bytes for `#[repr(usize)]` enum tags in derived `Encode::encoded_len`, and
allow fields named `writer`. Derived decoders now match discriminant expressions by value ([#643])
- Correct the `Vec<String>` documentation to describe an SSH string containing a sequence
of length-prefixed strings ([#646])
### Security
- Require `ctutils` v0.4.8 when that optional dependency is enabled, picking up upstream
constant-time fixes for mask generation and comparisons ([#610], [RUSTSEC-2026-0385])
[#610]: https://github.com/RustCrypto/SSH/pull/610
[#615]: https://github.com/RustCrypto/SSH/pull/615
[#618]: https://github.com/RustCrypto/SSH/pull/618
[#622]: https://github.com/RustCrypto/SSH/pull/622
[#627]: https://github.com/RustCrypto/SSH/pull/627
[#628]: https://github.com/RustCrypto/SSH/pull/628
[#637]: https://github.com/RustCrypto/SSH/pull/637
[#639]: https://github.com/RustCrypto/SSH/pull/639
[#641]: https://github.com/RustCrypto/SSH/pull/641
[#643]: https://github.com/RustCrypto/SSH/pull/643
[#644]: https://github.com/RustCrypto/SSH/pull/644
[#646]: https://github.com/RustCrypto/SSH/pull/646
[#647]: https://github.com/RustCrypto/SSH/pull/647
[#656]: https://github.com/RustCrypto/SSH/pull/656
[#659]: https://github.com/RustCrypto/SSH/pull/659
[#663]: https://github.com/RustCrypto/SSH/pull/663
[#665]: https://github.com/RustCrypto/SSH/pull/665
[#667]: https://github.com/RustCrypto/SSH/pull/667
[8cbd2a0]: https://github.com/RustCrypto/SSH/commit/8cbd2a001fff63aead2e3c83c8dbd95dce5a5e95
[RUSTSEC-2026-0385]: https://rustsec.org/advisories/RUSTSEC-2026-0385.html
## 0.3.0 (2026-05-25)
### Added
- `boolean` encode/decode support ([#214])
- `Base64Reader`/`Base64Writer` newtypes ([#220])
- `base64` module ([#222])
- PEM line width detection ([#252])
- `Encode::{encode_vec, encode_bytes}` ([#267])
- `DigestWriter` ([#268])
- `digest` feature ([#271])
- `core::error::Error` support ([#303])
- Custom derive for `Encode`/`Decode` via `derive` feature ([#348])
- Propagate `base64ct` errors ([#358])
- `Mpint` type ([#359])
- Implement `Encode` for string-like type sequences ([#377])
- `diagnostic::on_unimplemented` hints ([#514])
### Changed
- `[u8; N]` no longer encodes a length prefix but treats `N` as statically known ([#342])
- Upgrade to 2024 edition; MSRV 1.85 ([#354])
- Bump `hex-literal` dependency to v1 ([#355])
- Migrate from `subtle` to `ctutils` ([#507])
### Removed
- `NestedReader` ([#226])
- `sha2` dependency - now generic around digests ([#271])
- `std` feature ([#303])
[#214]: https://github.com/RustCrypto/SSH/pull/214
[#220]: https://github.com/RustCrypto/SSH/pull/220
[#222]: https://github.com/RustCrypto/SSH/pull/222
[#226]: https://github.com/RustCrypto/SSH/pull/226
[#252]: https://github.com/RustCrypto/SSH/pull/252
[#267]: https://github.com/RustCrypto/SSH/pull/267
[#268]: https://github.com/RustCrypto/SSH/pull/268
[#271]: https://github.com/RustCrypto/SSH/pull/271
[#303]: https://github.com/RustCrypto/SSH/pull/303
[#342]: https://github.com/RustCrypto/SSH/pull/342
[#348]: https://github.com/RustCrypto/SSH/pull/348
[#354]: https://github.com/RustCrypto/SSH/pull/354
[#355]: https://github.com/RustCrypto/SSH/pull/355
[#358]: https://github.com/RustCrypto/SSH/pull/358
[#359]: https://github.com/RustCrypto/SSH/pull/359
[#377]: https://github.com/RustCrypto/SSH/pull/377
[#507]: https://github.com/RustCrypto/SSH/pull/507
[#514]: https://github.com/RustCrypto/SSH/pull/514
## 0.2.0 (2023-08-11)
### Added
- `LabelError` ([#124])
- `bytes` feature ([#138])
### Changed
- Bump `pem-rfc7468` to v0.7 ([#84])
### Removed
- `Encoding::Error` ([#124])
[#84]: https://github.com/RustCrypto/SSH/pull/84
[#124]: https://github.com/RustCrypto/SSH/pull/124
[#138]: https://github.com/RustCrypto/SSH/pull/138
## 0.1.0 (2022-10-23)
- Initial release