2018-04-24 05:24:20 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
2018-08-07 08:35:03 +00:00
|
|
|
#include <fnd/aes.h>
|
|
|
|
#include <fnd/rsa.h>
|
2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/nca.h>
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
static const size_t kMasterKeyNum = 0x20;
|
2018-08-07 07:17:51 +00:00
|
|
|
static const size_t kNcaKeakNum = nn::hac::nca::kKeyAreaEncryptionKeyNum;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
enum FileType
|
|
|
|
{
|
|
|
|
FILE_XCI,
|
2018-05-22 02:30:31 +00:00
|
|
|
FILE_NSP,
|
2018-04-24 05:24:20 +00:00
|
|
|
FILE_PARTITIONFS,
|
|
|
|
FILE_ROMFS,
|
|
|
|
FILE_NCA,
|
|
|
|
FILE_NPDM,
|
2018-05-12 15:02:53 +00:00
|
|
|
FILE_CNMT,
|
2018-05-27 12:34:10 +00:00
|
|
|
FILE_NSO,
|
2018-06-09 15:32:35 +00:00
|
|
|
FILE_NRO,
|
2018-06-11 15:01:54 +00:00
|
|
|
FILE_NACP,
|
2018-08-06 09:11:15 +00:00
|
|
|
FILE_PKI_CERT,
|
2018-06-29 16:14:19 +00:00
|
|
|
FILE_ES_TIK,
|
2018-06-10 15:48:04 +00:00
|
|
|
FILE_HB_ASSET,
|
2018-04-24 05:24:20 +00:00
|
|
|
FILE_INVALID = -1,
|
|
|
|
};
|
|
|
|
|
2018-06-18 15:30:19 +00:00
|
|
|
enum CliOutputModeFlag
|
2018-04-24 05:24:20 +00:00
|
|
|
{
|
2018-06-18 15:30:19 +00:00
|
|
|
OUTPUT_BASIC,
|
|
|
|
OUTPUT_LAYOUT,
|
|
|
|
OUTPUT_KEY_DATA,
|
|
|
|
OUTPUT_EXTENDED
|
2018-04-24 05:24:20 +00:00
|
|
|
};
|
|
|
|
|
2018-06-18 15:30:19 +00:00
|
|
|
typedef byte_t CliOutputMode;
|
|
|
|
|
2018-04-24 05:24:20 +00:00
|
|
|
template <typename T>
|
|
|
|
struct sOptional
|
|
|
|
{
|
|
|
|
bool isSet;
|
|
|
|
T var;
|
2018-06-03 07:10:47 +00:00
|
|
|
inline sOptional() : isSet(false) {}
|
2018-08-24 08:08:16 +00:00
|
|
|
inline sOptional(const T& other) : isSet(true), var(other) {}
|
|
|
|
inline sOptional(const sOptional& other) : isSet(other.isSet), var(other.var) {}
|
2018-04-24 05:24:20 +00:00
|
|
|
inline const T& operator=(const T& other) { isSet = true; var = other; return var; }
|
|
|
|
inline const sOptional<T>& operator=(const sOptional<T>& other)
|
|
|
|
{
|
|
|
|
isSet = other.isSet;
|
|
|
|
if (isSet) {
|
|
|
|
var = other.var;
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
inline T& operator*() { return var; }
|
|
|
|
};
|
|
|
|
|
2018-08-20 11:56:28 +00:00
|
|
|
const byte_t kDummyRightsIdForUserTitleKey[nn::hac::nca::kRightsIdLen] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
2018-08-21 12:03:19 +00:00
|
|
|
const byte_t kDummyRightsIdForUserBodyKey[nn::hac::nca::kRightsIdLen] = {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
|