mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
Change formatting of hex data to exclude ":" between bytes.
This commit is contained in:
parent
141477207b
commit
be59f92a2c
|
@ -119,12 +119,12 @@ void nstool::EsTikProcess::displayTicket()
|
||||||
if (body.getTitleKeyEncType() == nn::es::ticket::RSA2048)
|
if (body.getTitleKeyEncType() == nn::es::ticket::RSA2048)
|
||||||
{
|
{
|
||||||
fmt::print(" Data:\n");
|
fmt::print(" Data:\n");
|
||||||
fmt::print(" {:s}", tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(body.getEncTitleKey(), 0x100, true, ":", 0x10, 6, false));
|
fmt::print(" {:s}", tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(body.getEncTitleKey(), 0x100, true, "", 0x10, 6, false));
|
||||||
}
|
}
|
||||||
else if (body.getTitleKeyEncType() == nn::es::ticket::AES128_CBC)
|
else if (body.getTitleKeyEncType() == nn::es::ticket::AES128_CBC)
|
||||||
{
|
{
|
||||||
fmt::print(" Data:\n");
|
fmt::print(" Data:\n");
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(body.getEncTitleKey(), 0x10, true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(body.getEncTitleKey(), 0x10, true, ""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,12 +153,12 @@ void nstool::GameCardProcess::displayHeader()
|
||||||
fmt::print(" TitleKeyDecIndex: {:d}\n", mHdr.getTitleKeyDecIndex());
|
fmt::print(" TitleKeyDecIndex: {:d}\n", mHdr.getTitleKeyDecIndex());
|
||||||
fmt::print(" InitialData:\n");
|
fmt::print(" InitialData:\n");
|
||||||
fmt::print(" Hash:\n");
|
fmt::print(" Hash:\n");
|
||||||
fmt::print(" {:s}", tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(mHdr.getInitialDataHash().data(), mHdr.getInitialDataHash().size(), true, ":", 0x10, 6, false));
|
fmt::print(" {:s}", tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(mHdr.getInitialDataHash().data(), mHdr.getInitialDataHash().size(), true, "", 0x10, 6, false));
|
||||||
}
|
}
|
||||||
if (mCliOutputMode.show_extended_info)
|
if (mCliOutputMode.show_extended_info)
|
||||||
{
|
{
|
||||||
fmt::print(" Extended Header AesCbc IV:\n");
|
fmt::print(" Extended Header AesCbc IV:\n");
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(mHdr.getAesCbcIv().data(), mHdr.getAesCbcIv().size(), true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(mHdr.getAesCbcIv().data(), mHdr.getAesCbcIv().size(), true, ""));
|
||||||
}
|
}
|
||||||
fmt::print(" SelSec: 0x{:x}\n", mHdr.getSelSec());
|
fmt::print(" SelSec: 0x{:x}\n", mHdr.getSelSec());
|
||||||
fmt::print(" SelT1Key: 0x{:x}\n", mHdr.getSelT1Key());
|
fmt::print(" SelT1Key: 0x{:x}\n", mHdr.getSelT1Key());
|
||||||
|
@ -191,7 +191,7 @@ void nstool::GameCardProcess::displayHeader()
|
||||||
if (mCliOutputMode.show_extended_info)
|
if (mCliOutputMode.show_extended_info)
|
||||||
{
|
{
|
||||||
fmt::print(" Hash:\n");
|
fmt::print(" Hash:\n");
|
||||||
fmt::print(" {:s}", tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(mHdr.getPartitionFsHash().data(), mHdr.getPartitionFsHash().size(), true, ":", 0x10, 6, false));
|
fmt::print(" {:s}", tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(mHdr.getPartitionFsHash().data(), mHdr.getPartitionFsHash().size(), true, "", 0x10, 6, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void nstool::GameCardProcess::displayHeader()
|
||||||
fmt::print(" Update Partition Info:\n");
|
fmt::print(" Update Partition Info:\n");
|
||||||
fmt::print(" CUP Version: {:s} (v{:d})\n", nn::hac::ContentMetaUtil::getVersionAsString(mHdr.getUppVersion()), mHdr.getUppVersion());
|
fmt::print(" CUP Version: {:s} (v{:d})\n", nn::hac::ContentMetaUtil::getVersionAsString(mHdr.getUppVersion()), mHdr.getUppVersion());
|
||||||
fmt::print(" CUP TitleId: 0x{:016x}\n", mHdr.getUppId());
|
fmt::print(" CUP TitleId: 0x{:016x}\n", mHdr.getUppId());
|
||||||
fmt::print(" CUP Digest: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(mHdr.getUppHash().data(), mHdr.getUppHash().size(), true, ":"));
|
fmt::print(" CUP Digest: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(mHdr.getUppHash().data(), mHdr.getUppHash().size(), true, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ void nstool::NcaProcess::generateNcaBodyEncryptionKeys()
|
||||||
if (mContentKey.aes_ctr.isSet())
|
if (mContentKey.aes_ctr.isSet())
|
||||||
{
|
{
|
||||||
fmt::print("[NCA Content Key]\n");
|
fmt::print("[NCA Content Key]\n");
|
||||||
fmt::print(" AES-CTR Key: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(mContentKey.aes_ctr.get().data(), mContentKey.aes_ctr.get().size(), true, ":"));
|
fmt::print(" AES-CTR Key: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(mContentKey.aes_ctr.get().data(), mContentKey.aes_ctr.get().size(), true, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,11 +423,11 @@ void nstool::NcaProcess::displayHeader()
|
||||||
fmt::print(" |-----|-------------------------------------------------|-------------------------------------------------|\n");
|
fmt::print(" |-----|-------------------------------------------------|-------------------------------------------------|\n");
|
||||||
for (size_t i = 0; i < mContentKey.kak_list.size(); i++)
|
for (size_t i = 0; i < mContentKey.kak_list.size(); i++)
|
||||||
{
|
{
|
||||||
fmt::print(" | {:3d} | {:s} | ", mContentKey.kak_list[i].index, tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].enc.data(), mContentKey.kak_list[i].enc.size(), true, ":"));
|
fmt::print(" | {:3d} | {:s} | ", mContentKey.kak_list[i].index, tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].enc.data(), mContentKey.kak_list[i].enc.size(), true, ""));
|
||||||
|
|
||||||
|
|
||||||
if (mContentKey.kak_list[i].decrypted)
|
if (mContentKey.kak_list[i].decrypted)
|
||||||
fmt::print("{:s}", tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].dec.data(), mContentKey.kak_list[i].dec.size(), true, ":"));
|
fmt::print("{:s}", tc::cli::FormatUtil::formatBytesAsString(mContentKey.kak_list[i].dec.data(), mContentKey.kak_list[i].dec.size(), true, ""));
|
||||||
else
|
else
|
||||||
fmt::print("<unable to decrypt> ");
|
fmt::print("<unable to decrypt> ");
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ void nstool::NcaProcess::displayHeader()
|
||||||
memcpy(aes_ctr.data(), info.aes_ctr.data(), aes_ctr.size());
|
memcpy(aes_ctr.data(), info.aes_ctr.data(), aes_ctr.size());
|
||||||
tc::crypto::detail::incr_counter<16>(aes_ctr.data(), info.offset>>4);
|
tc::crypto::detail::incr_counter<16>(aes_ctr.data(), info.offset>>4);
|
||||||
fmt::print(" AesCtr Counter:\n");
|
fmt::print(" AesCtr Counter:\n");
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(aes_ctr.data(), aes_ctr.size(), true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(aes_ctr.data(), aes_ctr.size(), true, ""));
|
||||||
}
|
}
|
||||||
if (info.hash_type == nn::hac::nca::HashType::HierarchicalIntegrity)
|
if (info.hash_type == nn::hac::nca::HashType::HierarchicalIntegrity)
|
||||||
{
|
{
|
||||||
|
@ -480,8 +480,8 @@ void nstool::NcaProcess::displayHeader()
|
||||||
for (size_t j = 0; j < hash_hdr.getMasterHashList().size(); j++)
|
for (size_t j = 0; j < hash_hdr.getMasterHashList().size(); j++)
|
||||||
{
|
{
|
||||||
fmt::print(" Master Hash {:d}:\n", j);
|
fmt::print(" Master Hash {:d}:\n", j);
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHashList()[j].data(), 0x10, true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHashList()[j].data(), 0x10, true, ""));
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHashList()[j].data()+0x10, 0x10, true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHashList()[j].data()+0x10, 0x10, true, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.hash_type == nn::hac::nca::HashType::HierarchicalSha256)
|
else if (info.hash_type == nn::hac::nca::HashType::HierarchicalSha256)
|
||||||
|
@ -489,8 +489,8 @@ void nstool::NcaProcess::displayHeader()
|
||||||
auto hash_hdr = info.hierarchicalsha256_hdr;
|
auto hash_hdr = info.hierarchicalsha256_hdr;
|
||||||
fmt::print(" HierarchicalSha256 Header:\n");
|
fmt::print(" HierarchicalSha256 Header:\n");
|
||||||
fmt::print(" Master Hash:\n");
|
fmt::print(" Master Hash:\n");
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHash().data(), 0x10, true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHash().data(), 0x10, true, ""));
|
||||||
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHash().data()+0x10, 0x10, true, ":"));
|
fmt::print(" {:s}\n", tc::cli::FormatUtil::formatBytesAsString(hash_hdr.getMasterHash().data()+0x10, 0x10, true, ""));
|
||||||
fmt::print(" HashBlockSize: 0x{:x}\n", hash_hdr.getHashBlockSize());
|
fmt::print(" HashBlockSize: 0x{:x}\n", hash_hdr.getHashBlockSize());
|
||||||
for (size_t j = 0; j < hash_hdr.getLayerInfo().size(); j++)
|
for (size_t j = 0; j < hash_hdr.getLayerInfo().size(); j++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -753,22 +753,22 @@ void nstool::SettingsInitializer::dump_keys() const
|
||||||
if (opt.keybag.nca_header_key.isSet())
|
if (opt.keybag.nca_header_key.isSet())
|
||||||
{
|
{
|
||||||
fmt::print(" Header-EncryptionKey:\n");
|
fmt::print(" Header-EncryptionKey:\n");
|
||||||
fmt::print(" Key0: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(opt.keybag.nca_header_key.get()[0].data(), opt.keybag.nca_header_key.get()[0].size(), true, ":"));
|
fmt::print(" Key0: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(opt.keybag.nca_header_key.get()[0].data(), opt.keybag.nca_header_key.get()[0].size(), true, ""));
|
||||||
fmt::print(" Key1: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(opt.keybag.nca_header_key.get()[1].data(), opt.keybag.nca_header_key.get()[1].size(), true, ":"));
|
fmt::print(" Key1: {:s}\n", tc::cli::FormatUtil::formatBytesAsString(opt.keybag.nca_header_key.get()[1].data(), opt.keybag.nca_header_key.get()[1].size(), true, ""));
|
||||||
}
|
}
|
||||||
std::vector<std::string> kaek_label = {"Application", "Ocean", "System"};
|
std::vector<std::string> kaek_label = {"Application", "Ocean", "System"};
|
||||||
for (size_t kaek_index = 0; kaek_index < opt.keybag.nca_key_area_encryption_key.size(); kaek_index++)
|
for (size_t kaek_index = 0; kaek_index < opt.keybag.nca_key_area_encryption_key.size(); kaek_index++)
|
||||||
{
|
{
|
||||||
for (auto itr = opt.keybag.nca_key_area_encryption_key[kaek_index].begin(); itr != opt.keybag.nca_key_area_encryption_key[kaek_index].end(); itr++)
|
for (auto itr = opt.keybag.nca_key_area_encryption_key[kaek_index].begin(); itr != opt.keybag.nca_key_area_encryption_key[kaek_index].end(); itr++)
|
||||||
{
|
{
|
||||||
fmt::print(" KeyAreaEncryptionKey-{:s}-{:02x}:\n {:s}\n", kaek_label[kaek_index], itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ":"));
|
fmt::print(" KeyAreaEncryptionKey-{:s}-{:02x}:\n {:s}\n", kaek_label[kaek_index], itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t kaek_index = 0; kaek_index < opt.keybag.nca_key_area_encryption_key_hw.size(); kaek_index++)
|
for (size_t kaek_index = 0; kaek_index < opt.keybag.nca_key_area_encryption_key_hw.size(); kaek_index++)
|
||||||
{
|
{
|
||||||
for (auto itr = opt.keybag.nca_key_area_encryption_key_hw[kaek_index].begin(); itr != opt.keybag.nca_key_area_encryption_key_hw[kaek_index].end(); itr++)
|
for (auto itr = opt.keybag.nca_key_area_encryption_key_hw[kaek_index].begin(); itr != opt.keybag.nca_key_area_encryption_key_hw[kaek_index].end(); itr++)
|
||||||
{
|
{
|
||||||
fmt::print(" KeyAreaEncryptionKeyHw-{:s}-{:02x}:\n {:s}\n", kaek_label[kaek_index], itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ":"));
|
fmt::print(" KeyAreaEncryptionKeyHw-{:s}-{:02x}:\n {:s}\n", kaek_label[kaek_index], itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt::print(" NRR Keys:\n");
|
fmt::print(" NRR Keys:\n");
|
||||||
|
@ -783,7 +783,7 @@ void nstool::SettingsInitializer::dump_keys() const
|
||||||
}
|
}
|
||||||
for (auto itr = opt.keybag.xci_header_key.begin(); itr != opt.keybag.xci_header_key.end(); itr++)
|
for (auto itr = opt.keybag.xci_header_key.begin(); itr != opt.keybag.xci_header_key.end(); itr++)
|
||||||
{
|
{
|
||||||
fmt::print(" ExtendedHeader-EncryptionKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ":"));
|
fmt::print(" ExtendedHeader-EncryptionKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ""));
|
||||||
}
|
}
|
||||||
if (opt.keybag.xci_cert_sign_key.isSet())
|
if (opt.keybag.xci_cert_sign_key.isSet())
|
||||||
{
|
{
|
||||||
|
@ -793,7 +793,7 @@ void nstool::SettingsInitializer::dump_keys() const
|
||||||
fmt::print(" Package1 Keys:\n");
|
fmt::print(" Package1 Keys:\n");
|
||||||
for (auto itr = opt.keybag.pkg1_key.begin(); itr != opt.keybag.pkg1_key.end(); itr++)
|
for (auto itr = opt.keybag.pkg1_key.begin(); itr != opt.keybag.pkg1_key.end(); itr++)
|
||||||
{
|
{
|
||||||
fmt::print(" EncryptionKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ":"));
|
fmt::print(" EncryptionKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print(" Package2 Keys:\n");
|
fmt::print(" Package2 Keys:\n");
|
||||||
|
@ -803,13 +803,13 @@ void nstool::SettingsInitializer::dump_keys() const
|
||||||
}
|
}
|
||||||
for (auto itr = opt.keybag.pkg2_key.begin(); itr != opt.keybag.pkg2_key.end(); itr++)
|
for (auto itr = opt.keybag.pkg2_key.begin(); itr != opt.keybag.pkg2_key.end(); itr++)
|
||||||
{
|
{
|
||||||
fmt::print(" EncryptionKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ":"));
|
fmt::print(" EncryptionKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print(" ETicket Keys:\n");
|
fmt::print(" ETicket Keys:\n");
|
||||||
for (auto itr = opt.keybag.etik_common_key.begin(); itr != opt.keybag.etik_common_key.end(); itr++)
|
for (auto itr = opt.keybag.etik_common_key.begin(); itr != opt.keybag.etik_common_key.end(); itr++)
|
||||||
{
|
{
|
||||||
fmt::print(" CommonKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ":"));
|
fmt::print(" CommonKey-{:02x}:\n {:s}\n", itr->first, tc::cli::FormatUtil::formatBytesAsString(itr->second.data(), itr->second.size(), true, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print(" BroadOn Signer Profiles:\n");
|
fmt::print(" BroadOn Signer Profiles:\n");
|
||||||
|
@ -858,7 +858,7 @@ void nstool::SettingsInitializer::dump_rsa_key(const KeyBag::rsa_key_t& key, con
|
||||||
if (expanded_key_data)
|
if (expanded_key_data)
|
||||||
{
|
{
|
||||||
fmt::print("{:s} Modulus:\n", indent_str);
|
fmt::print("{:s} Modulus:\n", indent_str);
|
||||||
fmt::print("{:s} {:s}", indent_str, tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(key.n.data(), key.n.size(), true, ":", 0x10, indent + 4, false));
|
fmt::print("{:s} {:s}", indent_str, tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(key.n.data(), key.n.size(), true, "", 0x10, indent + 4, false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -870,7 +870,7 @@ void nstool::SettingsInitializer::dump_rsa_key(const KeyBag::rsa_key_t& key, con
|
||||||
if (expanded_key_data)
|
if (expanded_key_data)
|
||||||
{
|
{
|
||||||
fmt::print("{:s} Private Exponent:\n", indent_str);
|
fmt::print("{:s} Private Exponent:\n", indent_str);
|
||||||
fmt::print("{:s} {:s}", indent_str, tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(key.d.data(), key.d.size(), true, ":", 0x10, indent + 4, false));
|
fmt::print("{:s} {:s}", indent_str, tc::cli::FormatUtil::formatBytesAsStringWithLineLimit(key.d.data(), key.d.size(), true, "", 0x10, indent + 4, false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue