mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
Change formatting of hex data to exclude ":" between bytes.
This commit is contained in:
parent
141477207b
commit
be59f92a2c
4 changed files with 24 additions and 24 deletions
|
@ -119,12 +119,12 @@ void nstool::EsTikProcess::displayTicket()
|
|||
if (body.getTitleKeyEncType() == nn::es::ticket::RSA2048)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
|
|
@ -153,12 +153,12 @@ void nstool::GameCardProcess::displayHeader()
|
|||
fmt::print(" TitleKeyDecIndex: {:d}\n", mHdr.getTitleKeyDecIndex());
|
||||
fmt::print(" InitialData:\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)
|
||||
{
|
||||
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(" SelT1Key: 0x{:x}\n", mHdr.getSelT1Key());
|
||||
|
@ -191,7 +191,7 @@ void nstool::GameCardProcess::displayHeader()
|
|||
if (mCliOutputMode.show_extended_info)
|
||||
{
|
||||
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(" 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 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())
|
||||
{
|
||||
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");
|
||||
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)
|
||||
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
|
||||
fmt::print("<unable to decrypt> ");
|
||||
|
||||
|
@ -457,7 +457,7 @@ void nstool::NcaProcess::displayHeader()
|
|||
memcpy(aes_ctr.data(), info.aes_ctr.data(), aes_ctr.size());
|
||||
tc::crypto::detail::incr_counter<16>(aes_ctr.data(), info.offset>>4);
|
||||
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)
|
||||
{
|
||||
|
@ -480,8 +480,8 @@ void nstool::NcaProcess::displayHeader()
|
|||
for (size_t j = 0; j < hash_hdr.getMasterHashList().size(); 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, 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, ""));
|
||||
}
|
||||
}
|
||||
else if (info.hash_type == nn::hac::nca::HashType::HierarchicalSha256)
|
||||
|
@ -489,8 +489,8 @@ void nstool::NcaProcess::displayHeader()
|
|||
auto hash_hdr = info.hierarchicalsha256_hdr;
|
||||
fmt::print(" HierarchicalSha256 Header:\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, 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(" HashBlockSize: 0x{:x}\n", hash_hdr.getHashBlockSize());
|
||||
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())
|
||||
{
|
||||
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(" 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(" 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, ""));
|
||||
}
|
||||
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 (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 (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");
|
||||
|
@ -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++)
|
||||
{
|
||||
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())
|
||||
{
|
||||
|
@ -793,7 +793,7 @@ void nstool::SettingsInitializer::dump_keys() const
|
|||
fmt::print(" Package1 Keys:\n");
|
||||
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");
|
||||
|
@ -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++)
|
||||
{
|
||||
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");
|
||||
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");
|
||||
|
@ -858,7 +858,7 @@ void nstool::SettingsInitializer::dump_rsa_key(const KeyBag::rsa_key_t& key, con
|
|||
if (expanded_key_data)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -870,7 +870,7 @@ void nstool::SettingsInitializer::dump_rsa_key(const KeyBag::rsa_key_t& key, con
|
|||
if (expanded_key_data)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue