miniproto.crypto
miniproto.crypto
Section titled “miniproto.crypto”Public cryptographic primitives for MTProto and encrypted session storage.
Exports preserve behavior across the optional Rust extension and fallback implementations. Individual wrappers document their backend dispatch, cryptographic input constraints, and validation behavior.
Public objects
Section titled “Public objects”EncryptedPayload— MTProto payload components produced by :func:encrypt_payload.auth_key_id— Return the MTProto auth-key identifier.decrypt_payload— Verify an MTProto message key and decrypt its AES-IGE payload.derive_aes_key_iv— Derive the AES-256 key and 32-byte IGE IV required by MTProto 2.0.encrypt_payload— Pad and AES-IGE-encrypt one MTProto payload.media_cbc_decrypt— Decrypt block-aligned AES-256-CBC media data without unpadding it.media_cbc_encrypt— Encrypt block-aligned media data with AES-256-CBC.media_ctr_crypt— Apply AES-256-CTR to CDN/media bytes.message_key— Derive the 16-byte MTProto 2.0 message key.aes_256_cbc_decrypt— Decrypt block-aligned AES-256-CBC bytes without unpadding.aes_256_cbc_encrypt— Encrypt block-aligned bytes with AES-256-CBC.aes_256_ctr_crypt— Apply AES-256-CTR to bytes for encryption or decryption.aes_256_gcm_decrypt— Authenticate and decrypt AES-256-GCM session bytes.aes_256_gcm_decrypt_cryptography— Authenticate and decrypt through the explicitcryptographyAES-GCM path.aes_256_gcm_decrypt_native— Authenticate and decrypt with explicit compiled Rust AES-256-GCM.aes_256_gcm_encrypt— Encrypt and authenticate session bytes with AES-256-GCM.aes_256_gcm_encrypt_cryptography— Encrypt and authenticate with the explicitcryptographyAES-GCM path.aes_256_gcm_encrypt_native— Encrypt with the explicit compiled Rust AES-256-GCM capability.aes_256_ige_decrypt— Decrypt block-aligned AES-256-IGE bytes.aes_256_ige_encrypt— Encrypt block-aligned bytes with AES-256-IGE.mtproto_decode_message— Decrypt, authenticate, and parse an MTProto encrypted message.mtproto_encode_message— Build, pad, and encrypt a complete MTProto encrypted message.native_available— Report whether a complete bundled Rust backend was selected.pq_factorize— Factor the composite integer used by the MTProto handshake.scrypt_derive— Derive key material with Scrypt through the available session backend.scrypt_derive_cryptography— Derive Scrypt key material with the explicitcryptographybackend.scrypt_derive_native— Derive Scrypt key material through explicit compiled Rust support.sha1_digest— Compute a SHA-1 digest for MTProto compatibility.sha256_digest— Compute a SHA-256 digest.xor_bytes— Return the byte-wise XOR of equal-length inputs.