INNER CODE UNIT · Rust
create_key
matrix-org/vodozemac · src/ecies/mod.rs:345
fn create_key(info: &str, shared_secret: &SharedSecret) -> Box<[u8; 32]> {
let mut key = Box::new([0u8; 32]);
let kdf: Hkdf<Sha512> = Hkdf::new(None, shared_secret.as_bytes());
#[allow(clippy::expect_used)]
kdf.expand(info.as_bytes(), key.as_mut_slice()).expect(
"We should be able to expand the 32-byte long shared secret into a 32 byte key.",
);
key
}
/// Create the encryption key for messages we send into the channel.
fn create_encryption_key(
shared_secret: &SharedSecret,
our_public_key: Curve25519PublicKey,
their_public_key: Curve25519PublicKey,
app_info: &str,