mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
[nstool] Fixed bugs in --titlekey processing.
This commit is contained in:
parent
7831f5b291
commit
7b2d682203
2 changed files with 16 additions and 4 deletions
|
@ -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;
|
||||||
|
if (body.getTitleKeyEncType() == nn::es::ticket::RSA2048)
|
||||||
|
{
|
||||||
std::cout << " Data:" << std::endl;
|
std::cout << " Data:" << std::endl;
|
||||||
size_t size = body.getTitleKeyEncType() == nn::es::ticket::RSA2048 ? fnd::rsa::kRsa2048Size : fnd::aes::kAes128KeySize;
|
for (size_t i = 0; i < 0x10; i++)
|
||||||
fnd::SimpleTextOutput::hexDump(body.getEncTitleKey(), size, 0x10, 6);
|
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