Skip to main content

Fek

Struct Fek 

Source
pub struct Fek(/* private fields */);
Expand description

文件加密密钥(File Encryption Key)。

每个文件独立随机生成,被各个 key slot 包裹。所有文件级子密钥都由它派生。

Implementations§

Source§

impl Fek

Source

pub fn random() -> Self

生成随机 FEK。

Source

pub const fn from_key(key: SecretKey) -> Self

由原始字节构造。

Source

pub const fn as_key(&self) -> &SecretKey

借出底层密钥。

Source

pub fn derive_payload_key(&self, file_uuid: &[u8; 16]) -> SecretKey

派生载荷加密密钥。

Source

pub fn derive_header_mac_key(&self, file_uuid: &[u8; 16]) -> SecretKey

派生头部 MAC 密钥。

Source

pub fn derive_tlv_key(&self, tlv_type: u16) -> SecretKey

派生某个 TLV 类型的加密密钥。

注意 salt 为空(规范 §4.3),与其它派生不同。

Trait Implementations§

Source§

impl Debug for Fek

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Fek

§

impl Freeze for Fek

§

impl RefUnwindSafe for Fek

§

impl Send for Fek

§

impl Sync for Fek

§

impl Unpin for Fek

§

impl UnsafeUnpin for Fek

§

impl UnwindSafe for Fek

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.