Skip to main content

Crate tc_key_wrap

Crate tc_key_wrap 

Source
Expand description

Key wrapping over the tc_block_cipher traits: RFC 3394 (AES key wrap), RFC 5649 (AES key wrap with padding) and RFC 3211, with the KeyWrap and KeyWrapInit contracts that algorithm-specific wrappers such as tc_des_wrap also implement.

The crate is no_std and needs no allocator by default. The default build provides the traits, parameter containers and errors that wrappers such as tc_des_wrap build on; each algorithm is behind its own feature:

  • rfc3394 — Rfc3394WrapEngine.
  • rfc5649 — Rfc5649WrapEngine; enables rfc3394, whose register loop it shares.
  • rfc3211 — Rfc3211WrapEngine; enables alloc and the rand_core dependency, since it sizes its state from the cipher at run time and draws random padding from a caller-supplied generator.
  • alloc — KeyWithIvOwned and KeyWithIvOptOwned.

Each engine’s documentation carries a usage example.

Structs§

KeyWithIvFixed
Owned, fixed-size key and initialization-vector parameters, wiped on drop.
KeyWithIvOptFixed
Owned, fixed-size key and optional initialization vector, wiped on drop.
KeyWithIvOptOwned
Owned key and optional initialization-vector vectors, wiped on drop.
KeyWithIvOptRef
Borrowed key and optional initialization vector.
KeyWithIvOwned
Owned key and initialization-vector vectors, wiped on drop.
KeyWithIvRef
Borrowed key and initialization-vector parameters.
Rfc3211WrapEngine
RFC 3211 key wrapping (the PWRI-KEK algorithm) over a cipher C with blocks of 4 bytes or more.
Rfc3394WrapEngine
RFC 3394 key wrapping (AES key wrap) over a cipher C with 16-byte blocks.
Rfc5649WrapEngine
RFC 5649 key wrapping with padding over a cipher C with 16-byte blocks.

Enums§

KeyWrapError
Why a key wrapper could not size, wrap or unwrap; E is the cipher’s error.
KeyWrapInitError
Why a key wrapper could not be initialized; E is the cipher’s initialization error.
WrapDirection
The operation selected during key-wrapper initialization.

Traits§

IvOptParams
Parameters that may provide an initialization vector.
IvParams
Parameters that provide an initialization vector.
KeyWrap
An initialized key-wrapping algorithm.
KeyWrapInit
Initializes a key wrapper from parameters of type P.