Skip to main content

Module key_wrap

Module key_wrap 

Source
Expand description

The key-wrapping backend: what holds the root of the key hierarchy and wraps each tenant key under it. The registry asks it for the root, from which the server catalog key is derived, and has it wrap and unwrap tenant keys; it never sees a data key or a body.

FileWrap is the backend every release so far has used: the master key from its file is the root, and a tenant key is wrapped under it with AES-256-GCM bound to the tenant id (envelope::wrap with Context::Tenant). What it writes is byte for byte what the code before this trait wrote, so data made by an older release opens unchanged.

BackendWrap puts a key Backend (a KMS or an HSM, whose key never leaves it) at the root instead. The root is a random key the backend wraps, kept as a key-wrap blob (blob) where the registry is. Each tenant key is wrapped locally under a key-encryption key of its own, with the same AES-256-GCM binding to the tenant id, and the backend wraps that key-encryption key.

Modules§

blob
The key-wrap format: a key as a key backend wrapped it, with the backend’s kind and the reference of the key that wrapped it, so a reader knows which backend and key opens it before it calls any backend.

Structs§

BackendWrap
The backend over a key Backend: its root is a random key the backend wraps, and each tenant key is wrapped locally under a new key-encryption key of its own, bound to the tenant, which the backend wraps. Debug shows the backend, its key and the root’s id only.
FileWrap
The master key file’s backend: the master key is the root, and tenant keys are wrapped under it locally. It holds the key, or borrows it (K is &Key) for a rotation that has the key already. Debug shows only the key’s id.
Wrapped
A tenant key as a backend wrapped it, as the registry keeps it: the wrapped key, and the key-encryption key it is wrapped under, as the key backend wrapped that; None when the wrapped key is under the master key file.
WrappedKek
A tenant’s key-encryption key as a key backend wrapped it: the backend’s key as WrapRef writes it, and the key-wrap blob. A registry keeps both or neither.

Enums§

WrapContext
What a key backend is asked to wrap or unwrap: the registry root, or the key-encryption key of one tenant. A backend that can bind a context to what it wraps binds this one, so a blob made for one does not open as another.
WrapError
Why a backend could not wrap or unwrap a key.

Traits§

Backend
A key backend: a service or a device that holds a key which never leaves it, and wraps and unwraps keys under that key. Its methods are synchronous: the registry calls them from blocking threads.
KeyWrap
A key-wrapping backend. Its methods are synchronous: the registry calls them from blocking threads.