Skip to content

miniproto_native::crypto::mtproto_encrypt_payload

  • Crate: miniproto_native
  • Rust visibility: restricted
  • Source: rust/miniproto/src/crypto.rs
  • Python exposure: miniproto._native.mtproto_encrypt_payload (confirmed from adjacent PyO3 attributes)
fn mtproto_encrypt_payload(py: _, auth_key: _, plaintext_with_padding: _, client_to_server: bool) -> _
  • py: The acquired GIL token used to detach large encryption work.
  • auth_key: The 256-byte MTProto authorization key.
  • plaintext_with_padding: AES-block-aligned inner plaintext to encrypt.
  • client_to_server: Selects the directional MTProto key schedule.
fn mtproto_encrypt_payload(py: Python<'_>, auth_key: Vec<u8>, plaintext_with_padding: Vec<u8>, client_to_server: bool) -> PyResult<(Vec<u8>, Vec<u8>, Vec<u8>)>

Defined in rust/miniproto/src/crypto.rs:202-212

Encrypts padded MTProto plaintext for Python mtproto_encrypt_payload.

Returns (auth_key_id, msg_key, ciphertext) or ValueError for invalid key or block input; large work runs without the GIL.

  • py: The acquired GIL token used to detach large encryption work.
  • auth_key: The 256-byte MTProto authorization key.
  • plaintext_with_padding: AES-block-aligned inner plaintext to encrypt.
  • client_to_server: Selects the directional MTProto key schedule.