tc_key_wrap 0.1.0

RFC 3394, RFC 5649 and RFC 3211 key wrapping over block ciphers, with shared key-wrap traits.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Key-wrapper initialization contract.

use crate::WrapDirection;

/// Initializes a key wrapper from parameters of type `P`.
///
/// This trait is independent of [`KeyWrap`](crate::KeyWrap). Consumers that
/// need both capabilities use `W: KeyWrap + KeyWrapInit<P>`. Keeping `P` as a
/// trait parameter lets one caller-owned parameter object flow through
/// composing cryptographic layers.
pub trait KeyWrapInit<P: ?Sized> {
    /// The failure type returned by initialization.
    type Error: core::error::Error;

    /// Initializes the implementation for wrapping or unwrapping.
    fn init(&mut self, direction: WrapDirection, params: &P) -> Result<(), Self::Error>;
}