pub struct Amk(/* private fields */);Expand description
A random 32-byte album content key for one epoch. Holding it lets you decrypt; not
holding it means you cannot (secrecy is enforced by encryption, authorization by
signatures — see HybridSigningKey write-tier keys).
Implementations§
Source§impl Amk
impl Amk
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Wrap raw AMK bytes (e.g. from the escrowed ledger).
Sourcepub fn as_bytes(&self) -> &[u8; 32]
pub fn as_bytes(&self) -> &[u8; 32]
Borrow the raw bytes (for escrow into the backup AMK ledger).
Sourcepub fn derive_file_key(&self, file_id: &Uuid, nonce_prefix: &[u8]) -> [u8; 32]
pub fn derive_file_key(&self, file_id: &Uuid, nonce_prefix: &[u8]) -> [u8; 32]
Derive the per-file AES-256 key:
HKDF(ikm=AMK, salt=file_id || nonce_prefix, info="asset-file/v1").
The fresh nonce_prefix drawn for this encryption is folded into the salt, so a
same-epoch replace (constant file_id) re-rolls the key, not merely the
nonce — no (file_key, nonce_prefix) pair is ever reused, which is what lets the
STREAM counter safely start at zero. The re-keying writers in
crypto::encryption’s re-keying writers draw the nonce and derive together (the salt
depends on the nonce). SSoT: Encryption § Asset Key Derivation.
Sourcepub fn derive_blob_key(&self, blob_id: &Uuid, nonce: &[u8]) -> [u8; 32]
pub fn derive_blob_key(&self, blob_id: &Uuid, nonce: &[u8]) -> [u8; 32]
Derive the per-metadata-blob AES-256 key:
HKDF(ikm=AMK, salt=blob_id || nonce, info="metadata-blob/v1").
The blob’s fresh 12-byte nonce is folded into the salt, so the key is re-derived
per write even though blob_id (the asset id) is constant across a metadata-update.
Sourcepub fn derive_wrap_key(&self, file_id: &Uuid, wrap_nonce: &[u8]) -> [u8; 32]
pub fn derive_wrap_key(&self, file_id: &Uuid, wrap_nonce: &[u8]) -> [u8; 32]
Derive the AES-256 key that wraps an externally-chosen file key K for an adopted
web-upload drop (key_mode = wrapped):
HKDF(ikm=AMK, salt=file_id || wrap_nonce, info="asset-keywrap/v1").
The fresh wrap_nonce is folded into the salt exactly as nonce_prefix is for a
derived file key, so no (wrap_key, wrap_nonce) pair repeats even under a constant
file_id. Used only by the keywrap seal/unseal path
(crate::crypto::encryption::seal_file_key).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Amk
impl RefUnwindSafe for Amk
impl Send for Amk
impl Sync for Amk
impl Unpin for Amk
impl UnsafeUnpin for Amk
impl UnwindSafe for Amk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more