Skip to content

miniproto_native::crypto::mtproto_derive_aes_key_iv

  • Crate: miniproto_native
  • Rust visibility: restricted
  • Source: rust/miniproto/src/crypto.rs
  • Python exposure: miniproto._native.mtproto_derive_aes_key_iv (confirmed from adjacent PyO3 attributes)
fn mtproto_derive_aes_key_iv(py: _, auth_key: _, msg_key: _, client_to_server: bool) -> _
  • py: The acquired GIL token retained by this bounded-size operation.
  • auth_key: The 256-byte MTProto authorization key.
  • msg_key: The 16-byte MTProto message key.
  • client_to_server: Selects the directional MTProto key offset.
fn mtproto_derive_aes_key_iv(py: Python<'_>, auth_key: Vec<u8>, msg_key: Vec<u8>, client_to_server: bool) -> PyResult<(Vec<u8>, Vec<u8>)>

Defined in rust/miniproto/src/crypto.rs:172-188

Derives the AES-256 key and IV used by Python mtproto_derive_aes_key_iv.

Returns (key, iv) and validates both fixed-width inputs. Valid inputs total 272 bytes (auth_key 256 plus msg_key 16), so this wrapper never exceeds the detach threshold and performs the derivation while holding the GIL.

  • py: The acquired GIL token retained by this bounded-size operation.
  • auth_key: The 256-byte MTProto authorization key.
  • msg_key: The 16-byte MTProto message key.
  • client_to_server: Selects the directional MTProto key offset.