Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions crypto-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Sealed `BlockSizes` trait implemented for types from `U1` to `U255`
- `Generate` trait ([#2096])
- `KeyExport` trait ([#2213])

### Changed
- `BlockUser::BlockSize` is now bounded by the `BlockSizes` trait
Expand All @@ -20,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[#1759]: https://github.com/RustCrypto/traits/pull/1759
[#2096]: https://github.com/RustCrypto/traits/pull/2096
[#2213]: https://github.com/RustCrypto/traits/pull/2213

## 0.1.7 (2025-11-12)
### Changed
Expand Down
6 changes: 6 additions & 0 deletions crypto-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ pub trait AlgorithmName {
fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result;
}

/// Serialize a key to a byte array.
pub trait KeyExport: KeySizeUser {
/// Serialize this key as a byte array.
fn to_bytes(&self) -> Key<Self>;
}

/// Types which can be initialized from a key.
pub trait KeyInit: KeySizeUser + Sized {
/// Create new value from fixed size key.
Expand Down