libWiiPy.title.crypto Module#
The libWiiPy.title.crypto
module provides low-level cryptography functions required for handling digital Wii titles. It does not expose many functions that are likely to be required during typical use, and instead acts more as a dependency for other modules.
Module Contents#
- libWiiPy.title.crypto.decrypt_content(content_enc, title_key, content_index, content_length) bytes #
Gets the decrypted version of the encrypted content.
This requires the index of the content to decrypt as it is used as the IV, as well as the content length to adjust padding as necessary.
- Parameters:
content_enc (bytes) – The encrypted content.
title_key (bytes) – The Title Key for the title the content is from.
content_index (int) – The index in the TMD’s content record of the content being decrypted.
content_length (int) – The length in the TMD’s content record of the content being decrypted.
- Returns:
The decrypted content.
- Return type:
bytes
- libWiiPy.title.crypto.decrypt_title_key(title_key_enc: bytes, common_key_index: int, title_id: bytes | str, dev=False) bytes #
Gets the decrypted version of the encrypted Title Key provided.
Requires the index of the common key to use, and the Title ID of the title that the Title Key is for.
- Parameters:
title_key_enc (bytes) – The encrypted Title Key.
common_key_index (int) – The index of the common key used to encrypt the Title Key.
title_id (bytes, str) – The Title ID of the title that the key is for.
dev (bool) – Whether the Title Key is encrypted with the development key or not.
- Returns:
The decrypted Title Key.
- Return type:
bytes
- libWiiPy.title.crypto.encrypt_content(content_dec, title_key, content_index) bytes #
Gets the encrypted version of the decrypted content.
This requires the index of the content to encrypt as it is used as the IV, as well as the content length to adjust padding as necessary.
- Parameters:
content_dec (bytes) – The decrypted content.
title_key (bytes) – The Title Key for the title the content is from.
content_index (int) – The index in the TMD’s content record of the content being decrypted.
- Returns:
The encrypted content.
- Return type:
bytes
- libWiiPy.title.crypto.encrypt_title_key(title_key_dec: bytes, common_key_index: int, title_id: bytes | str, dev=False) bytes #
Encrypts the provided Title Key with the selected common key.
Requires the index of the common key to use, and the Title ID of the title that the Title Key is for.
- Parameters:
title_key_dec (bytes) – The decrypted Title Key.
common_key_index (int) – The index of the common key used to encrypt the Title Key.
title_id (bytes, str) – The Title ID of the title that the key is for.
dev (bool) – Whether the Title Key is encrypted with the development key or not.
- Returns:
An encrypted Title Key.
- Return type:
bytes