ncch_container: support encrypted games
This commit is contained in:
parent
b92660435c
commit
d4a808c885
17 changed files with 319 additions and 103 deletions
|
@ -56,13 +56,6 @@ struct KeySlot {
|
|||
|
||||
std::array<KeySlot, KeySlotID::MaxKeySlotID> key_slots;
|
||||
|
||||
void ClearAllKeys() {
|
||||
for (KeySlot& slot : key_slots) {
|
||||
slot.Clear();
|
||||
}
|
||||
generator_constant.reset();
|
||||
}
|
||||
|
||||
AESKey HexToKey(const std::string& hex) {
|
||||
if (hex.size() < 32) {
|
||||
throw std::invalid_argument("hex string is too short");
|
||||
|
@ -141,8 +134,11 @@ void LoadPresetKeys() {
|
|||
} // namespace
|
||||
|
||||
void InitKeys() {
|
||||
ClearAllKeys();
|
||||
static bool initialized = false;
|
||||
if (initialized)
|
||||
return;
|
||||
LoadPresetKeys();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void SetGeneratorConstant(const AESKey& key) {
|
||||
|
|
|
@ -12,8 +12,16 @@ namespace HW {
|
|||
namespace AES {
|
||||
|
||||
enum KeySlotID : size_t {
|
||||
// AES Keyslot used to generate the UDS data frame CCMP key.
|
||||
// AES keyslots used to decrypt NCCH
|
||||
NCCHSecure1 = 0x2C,
|
||||
NCCHSecure2 = 0x25,
|
||||
NCCHSecure3 = 0x18,
|
||||
NCCHSecure4 = 0x1B,
|
||||
|
||||
// AES keyslot used to generate the UDS data frame CCMP key.
|
||||
UDSDataKey = 0x2D,
|
||||
|
||||
// AES keyslot used for APT:Wrap/Unwrap functions
|
||||
APTWrap = 0x31,
|
||||
|
||||
MaxKeySlotID = 0x40,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue