mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +00:00
[nstool] Fixed bugs in --titlekey processing.
This commit is contained in:
parent
7831f5b291
commit
7b2d682203
|
@ -122,9 +122,21 @@ void EsTikProcess::displayTicket()
|
||||||
std::cout << " Title Key:" << std::endl;
|
std::cout << " Title Key:" << std::endl;
|
||||||
std::cout << " EncMode: " << getTitleKeyPersonalisationStr(body.getTitleKeyEncType()) << std::endl;
|
std::cout << " EncMode: " << getTitleKeyPersonalisationStr(body.getTitleKeyEncType()) << std::endl;
|
||||||
std::cout << " KeyGeneration: " << std::dec << (uint32_t)body.getCommonKeyId() << std::endl;
|
std::cout << " KeyGeneration: " << std::dec << (uint32_t)body.getCommonKeyId() << std::endl;
|
||||||
std::cout << " Data:" << std::endl;
|
if (body.getTitleKeyEncType() == nn::es::ticket::RSA2048)
|
||||||
size_t size = body.getTitleKeyEncType() == nn::es::ticket::RSA2048 ? fnd::rsa::kRsa2048Size : fnd::aes::kAes128KeySize;
|
{
|
||||||
fnd::SimpleTextOutput::hexDump(body.getEncTitleKey(), size, 0x10, 6);
|
std::cout << " Data:" << std::endl;
|
||||||
|
for (size_t i = 0; i < 0x10; i++)
|
||||||
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(body.getEncTitleKey() + 0x10*i, 0x10, true, ":") << std::endl;
|
||||||
|
}
|
||||||
|
else if (body.getTitleKeyEncType() == nn::es::ticket::AES128_CBC)
|
||||||
|
{
|
||||||
|
std::cout << " Data:" << std::endl;
|
||||||
|
std::cout << " " << fnd::SimpleTextOutput::arrayToString(body.getEncTitleKey(), 0x10, true, ":") << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << " Data: <cannot display>" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << " Version: v" << _SPLIT_VER(body.getTicketVersion());
|
std::cout << " Version: v" << _SPLIT_VER(body.getTicketVersion());
|
||||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||||
|
|
|
@ -431,7 +431,7 @@ void UserSettings::populateKeyset(sCmdArgs& args)
|
||||||
{
|
{
|
||||||
fnd::aes::sAes128Key tmp_key;
|
fnd::aes::sAes128Key tmp_key;
|
||||||
fnd::Vec<byte_t> tmp_raw;
|
fnd::Vec<byte_t> tmp_raw;
|
||||||
fnd::SimpleTextOutput::stringToArray(args.nca_bodykey.var, tmp_raw);
|
fnd::SimpleTextOutput::stringToArray(args.nca_titlekey.var, tmp_raw);
|
||||||
if (tmp_raw.size() != sizeof(fnd::aes::sAes128Key))
|
if (tmp_raw.size() != sizeof(fnd::aes::sAes128Key))
|
||||||
throw fnd::Exception(kModuleName, "Key: \"--titlekey\" has incorrect length");
|
throw fnd::Exception(kModuleName, "Key: \"--titlekey\" has incorrect length");
|
||||||
memcpy(tmp_key.key, tmp_raw.data(), 16);
|
memcpy(tmp_key.key, tmp_raw.data(), 16);
|
||||||
|
|
Loading…
Reference in a new issue