Reworked commonkeys.py to return the keys as strings for now

This commit is contained in:
Campbell 2024-02-26 23:20:49 -05:00
parent 87685d3c98
commit c4d0d3e4e4
5 changed files with 31 additions and 20 deletions

3
.gitignore vendored
View File

@ -160,3 +160,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
# Allows me to keep TMD files in my repository folder for testing without accidentally publishing them
*.tmd

View File

@ -6,7 +6,7 @@ authors = [
]
description = "A Wii-related library for Python"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",

View File

@ -1,17 +0,0 @@
from .shared import hex_string_to_byte_array
class CommonKey:
def __init__(self):
self.default_key = "ebe42a225e8593e448d9c5457381aaf7"
self.korean_key = "63b82bb4f4614e2e13f2fefbba4c9b7e"
self.vwii_key = "30bfc76e7c19afbb23163330ced7c28d"
def get_default_key(self):
return hex_string_to_byte_array(self.default_key)
def get_korean_key(self):
return hex_string_to_byte_array(self.korean_key)
def get_vwii_key(self):
return hex_string_to_byte_array(self.vwii_key)

View File

@ -0,0 +1,20 @@
# "commonkeys.py" from libWiiPy by NinjaCheetah
default_key = 'ebe42a225e8593e448d9c5457381aaf7'
korean_key = '63b82bb4f4614e2e13f2fefbba4c9b7e'
vwii_key = '30bfc76e7c19afbb23163330ced7c28d'
def get_default_key():
"""Returns the regular Wii Common Key used to encrypt most content."""
return default_key
def get_korean_key():
"""Returns the Korean Wii Common Key used to encrypt Korean content."""
return korean_key
def get_vwii_key():
"""Returns the vWii Common Key used to encrypt vWii-specific content."""
return vwii_key

View File

@ -1,3 +1,6 @@
# "tmd.py" from libWiiPy by NinjaCheetah
# See https://wiibrew.org/wiki/Title_metadata for details about the TMD format
import binascii
from dataclasses import dataclass
from typing import List
@ -5,6 +8,7 @@ from typing import List
@dataclass
class ContentRecord:
"""Creates a content record object that contains the details of a content contained in a title."""
cid: int # Content ID
index: int # Index in the list of contents
content_type: int # normal: 0x0001; dlc: 0x4001; shared: 0x8001
@ -13,11 +17,12 @@ class ContentRecord:
class TMD:
"""Creates a TMD object that can be used to read all the data contained in a TMD."""
def __init__(self, tmd):
self.tmd = tmd
self.sig_type: int
self.sig: bytearray
self.issuer: bytearray # Root-CA%08x-CP%08x
self.issuer: bytearray # Follows the format "Root-CA%08x-CP%08x"
self.version: bytearray # This seems to always be 0 no matter what?
self.ca_crl_version: int
self.signer_crl_version: int