Skip to main content

KeyDerivation

Trait KeyDerivation 

Source
pub trait KeyDerivation:
    Identified
    + Send
    + Sync {
    // Required method
    fn derive(
        &self,
        ikm: &[u8],
        salt: &[u8],
        length: usize,
        info: &[u8],
    ) -> Result<Vec<u8>>;
}
Expand description

基于密钥材料的派生(典型为 HKDF):从 IKM + salt + info 得到任意长度输出。

Required Methods§

Source

fn derive( &self, ikm: &[u8], salt: &[u8], length: usize, info: &[u8], ) -> Result<Vec<u8>>

ikm:输入密钥材料(如主密钥、DH 共享秘密); salt:盐值(可为空,但建议非空随机); info:可选上下文信息(如协议标签)。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§