xbox.auxiliary.crypto module

Cryptography portion used for Title Channel aka Auxiliary Stream

class xbox.auxiliary.crypto.AuxiliaryStreamCrypto(crypto_key, hash_key, server_iv, client_iv)

Bases: object

__init__(crypto_key, hash_key, server_iv, client_iv)

Initialize Auxiliary Stream Crypto-context.

classmethod from_connection_info(connection_info)

Initialize Crypto context via AuxiliaryStream-message connection info.

encrypt(plaintext)

Encrypts plaintext with AES-128-CBC

No padding is added here, data has to be aligned to block size (16 bytes).

Parameters

plaintext (bytes) – The plaintext to encrypt.

Returns

Encrypted Data

Return type

bytes

encrypt_server(plaintext)
decrypt(ciphertext)

Decrypts ciphertext

No padding is removed here.

Parameters

ciphertext (bytes) – Ciphertext to be decrypted

Returns

Decrypted data

Return type

bytes

decrypt_client(ciphertext)
hash(data)

Securely hashes data with HMAC SHA-256

Parameters

data (bytes) – The data to securely hash.

Returns

Hashed data

Return type

bytes

verify(data, secure_hash)

Verifies that the given data generates the given secure_hash

Parameters
  • data (bytes) – The data to validate.

  • secure_hash (bytes) – The secure hash to validate against.

Returns

True on success, False otherwise

Return type

bool