mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
Add the ability to import initial_data_kek
This commit is contained in:
parent
a3996eaf0c
commit
6d9510cde4
|
@ -132,6 +132,7 @@ void nstool::KeyBagInitializer::importBaseKeyFile(const tc::io::Path& keyfile_pa
|
||||||
std::vector<std::string> kPkg1Base = { "package1" };
|
std::vector<std::string> kPkg1Base = { "package1" };
|
||||||
std::vector<std::string> kPkg2Base = { "package2" };
|
std::vector<std::string> kPkg2Base = { "package2" };
|
||||||
std::vector<std::string> kXciHeaderBase = { "xci_header" };
|
std::vector<std::string> kXciHeaderBase = { "xci_header" };
|
||||||
|
std::vector<std::string> kXciInitialDataBase = { "xci_initial_data" };
|
||||||
std::vector<std::string> kXciCertBase = { "xci_cert" };
|
std::vector<std::string> kXciCertBase = { "xci_cert" };
|
||||||
std::vector<std::string> kContentArchiveHeaderBase = { "nca_header", "header" };
|
std::vector<std::string> kContentArchiveHeaderBase = { "nca_header", "header" };
|
||||||
std::vector<std::string> kAcidBase = { "acid" };
|
std::vector<std::string> kAcidBase = { "acid" };
|
||||||
|
@ -358,6 +359,18 @@ void nstool::KeyBagInitializer::importBaseKeyFile(const tc::io::Path& keyfile_pa
|
||||||
//fmt::print("{:s}_{:s}_{:s}\n", kXciHeaderBase[name_idx], kSignKey, kModulusStr);
|
//fmt::print("{:s}_{:s}_{:s}\n", kXciHeaderBase[name_idx], kSignKey, kModulusStr);
|
||||||
_SAVE_RSAKEY(fmt::format("{:s}_{:s}", kXciHeaderBase[name_idx], kSignKey), xci_header_sign_key, 2048);
|
_SAVE_RSAKEY(fmt::format("{:s}_{:s}", kXciHeaderBase[name_idx], kSignKey), xci_header_sign_key, 2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XCI InitialData */
|
||||||
|
if (name_idx < kXciInitialDataBase.size())
|
||||||
|
{
|
||||||
|
// xci initial data key (based on index)
|
||||||
|
for (size_t kek_index = 0; kek_index < 8; kek_index++)
|
||||||
|
{
|
||||||
|
//fmt::print("{:s}_{:s}_{:02x}\n", kXciInitialDataBase[name_idx], kKekStr, kek_index);
|
||||||
|
_SAVE_AES128KEY(fmt::format("{:s}_{:s}_{:02x}", kXciInitialDataBase[name_idx], kKekStr, kek_index), xci_initial_data_kek[kek_index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* XCI cert */
|
/* XCI cert */
|
||||||
if (name_idx < kXciCertBase.size())
|
if (name_idx < kXciCertBase.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,7 @@ struct KeyBag
|
||||||
// xci
|
// xci
|
||||||
tc::Optional<rsa_key_t> xci_header_sign_key;
|
tc::Optional<rsa_key_t> xci_header_sign_key;
|
||||||
std::map<byte_t, aes128_key_t> xci_header_key;
|
std::map<byte_t, aes128_key_t> xci_header_key;
|
||||||
|
std::map<byte_t, aes128_key_t> xci_initial_data_kek;
|
||||||
tc::Optional<rsa_key_t> xci_cert_sign_key;
|
tc::Optional<rsa_key_t> xci_cert_sign_key;
|
||||||
|
|
||||||
// ticket
|
// ticket
|
||||||
|
|
Loading…
Reference in a new issue