miniproto.auth.key_exchange.rsa_pad
miniproto.auth.key_exchange.rsa_pad
Section titled “miniproto.auth.key_exchange.rsa_pad”rsa_pad(data: bytes, key: RSAKey, *, random_bytes: Callable[[int], bytes] | None = None) -> bytesApply Telegram’s randomized RSA_PAD encryption to a small inner payload.
Parameters:
- data (
bytes) – Plaintext inner data no longer than 144 bytes. - key (
RSAKey) – Trusted server RSA public key. - random_bytes (
Callable[[int], bytes] | None) – Secure random source for padding and temporary AES key material.
Returns:
bytes– A 256-byte RSA ciphertext below the server modulus.
Raises:
ValueError– If the input is oversized or no valid padded integer is produced in 32 attempts.