(Title) Add check to make sure Ticket data exist before decrypting content

This commit is contained in:
Campbell 2025-04-17 16:31:16 -04:00
parent 8adbef26b1
commit 8269a0db98
Signed by: NinjaCheetah
GPG Key ID: 39C2500E1778B156
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[project]
name = "libWiiPy"
version = "0.6.0"
version = "0.6.1"
authors = [
{ name="NinjaCheetah", email="ninjacheetah@ncxprogramming.com" },
{ name="Lillian Skinner", email="lillian@randommeaninglesscharacters.com" }

View File

@ -75,7 +75,7 @@ class Ticket:
self.title_version: int = 0 # Version of the ticket's associated title.
self.permitted_titles: bytes = b'' # Permitted titles mask
# "Permit mask. The current disc title is ANDed with the inverse of this mask to see if the result matches the
# Permitted Titles Mask."
# Permitted Titles Mask." -WiiBrew
self.permit_mask: bytes = b''
self.title_export_allowed: int = 0 # Whether title export is allowed with a PRNG key or not.
self.common_key_index: int = 0 # Which common key should be used. 0 = Common Key, 1 = Korean Key, 2 = vWii Key

View File

@ -194,6 +194,8 @@ class Title:
bytes
The decrypted content listed in the content record.
"""
if self.ticket.title_id == "":
raise ValueError("A Ticket must be loaded to get decrypted content.")
dec_content = self.content.get_content_by_index(index, self.ticket.get_title_key(), skip_hash)
return dec_content
@ -213,6 +215,8 @@ class Title:
bytes
The decrypted content listed in the content record.
"""
if self.ticket.title_id == "":
raise ValueError("A Ticket must be loaded to get decrypted content.")
dec_content = self.content.get_content_by_cid(cid, self.ticket.get_title_key(), skip_hash)
return dec_content