mirror of
https://github.com/jakcron/nstool
synced 2024-12-25 14:11:14 +00:00
[tiktool] Behind the scenes formating changes.
This commit is contained in:
parent
109b64be52
commit
584edf1f3d
1 changed files with 16 additions and 34 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include <crypto/aes.h>
|
#include <crypto/aes.h>
|
||||||
#include <fnd/io.h>
|
#include <fnd/io.h>
|
||||||
#include <fnd/MemoryBlob.h>
|
#include <fnd/MemoryBlob.h>
|
||||||
|
#include <fnd/SimpleTextOutput.h>
|
||||||
#include <es/ETicketBody_V2.h>
|
#include <es/ETicketBody_V2.h>
|
||||||
|
|
||||||
const std::string kTitleKeyPersonalisation[2] =
|
const std::string kTitleKeyPersonalisation[2] =
|
||||||
|
@ -13,12 +14,12 @@ const std::string kTitleKeyPersonalisation[2] =
|
||||||
|
|
||||||
const std::string kLicenseType[6] =
|
const std::string kLicenseType[6] =
|
||||||
{
|
{
|
||||||
"PERMANENT",
|
"Permanent",
|
||||||
"DEMO",
|
"Demo",
|
||||||
"TRIAL",
|
"Trial",
|
||||||
"RENTAL",
|
"Rental",
|
||||||
"SUBSCRIPTION",
|
"Subscription",
|
||||||
"SERVICE"
|
"Service"
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string kBooleanStr[2] =
|
const std::string kBooleanStr[2] =
|
||||||
|
@ -29,6 +30,7 @@ const std::string kBooleanStr[2] =
|
||||||
|
|
||||||
const byte_t eticket_common_key[16] = { 0x55, 0xA3, 0xF8, 0x72, 0xBD, 0xC8, 0x0C, 0x55, 0x5A, 0x65, 0x43, 0x81, 0x13, 0x9E, 0x15, 0x3B }; // lol this 3ds dev common key
|
const byte_t eticket_common_key[16] = { 0x55, 0xA3, 0xF8, 0x72, 0xBD, 0xC8, 0x0C, 0x55, 0x5A, 0x65, 0x43, 0x81, 0x13, 0x9E, 0x15, 0x3B }; // lol this 3ds dev common key
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
|
@ -51,16 +53,9 @@ int main(int argc, char** argv)
|
||||||
printf(" Title Key:\n");
|
printf(" Title Key:\n");
|
||||||
printf(" EncMode: %s\n", kTitleKeyPersonalisation[body.getTitleKeyEncType()].c_str());
|
printf(" EncMode: %s\n", kTitleKeyPersonalisation[body.getTitleKeyEncType()].c_str());
|
||||||
printf(" CommonKeyId: %02X\n", body.getCommonKeyId());
|
printf(" CommonKeyId: %02X\n", body.getCommonKeyId());
|
||||||
printf(" EncData:");
|
printf(" EncData:\n");
|
||||||
size_t size = body.getTitleKeyEncType() == es::ETicketBody_V2::RSA2048 ? crypto::rsa::kRsa2048Size : crypto::aes::kAes128KeySize;
|
size_t size = body.getTitleKeyEncType() == es::ETicketBody_V2::RSA2048 ? crypto::rsa::kRsa2048Size : crypto::aes::kAes128KeySize;
|
||||||
for (uint32_t i = 0; i < size; i++)
|
fnd::SimpleTextOutput::hexDump(body.getEncTitleKey(), size, 0x10, 6);
|
||||||
{
|
|
||||||
if (i % 16 == 0)
|
|
||||||
{
|
|
||||||
printf("\n ");
|
|
||||||
}
|
|
||||||
printf("%02X%s", body.getEncTitleKey()[i], (i+1 != size) ? "" : "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (body.getTitleKeyEncType() == es::ETicketBody_V2::AES128_CBC && body.getCommonKeyId() == 0)
|
if (body.getTitleKeyEncType() == es::ETicketBody_V2::AES128_CBC && body.getCommonKeyId() == 0)
|
||||||
{
|
{
|
||||||
|
@ -69,15 +64,8 @@ int main(int argc, char** argv)
|
||||||
memcpy(iv, body.getRightsId(), crypto::aes::kAesBlockSize);
|
memcpy(iv, body.getRightsId(), crypto::aes::kAesBlockSize);
|
||||||
crypto::aes::AesCbcDecrypt(body.getEncTitleKey(), crypto::aes::kAes128KeySize, eticket_common_key, iv, key);
|
crypto::aes::AesCbcDecrypt(body.getEncTitleKey(), crypto::aes::kAes128KeySize, eticket_common_key, iv, key);
|
||||||
size = crypto::aes::kAes128KeySize;
|
size = crypto::aes::kAes128KeySize;
|
||||||
printf(" TitleKey:");
|
printf(" TitleKey:\n");
|
||||||
for (uint32_t i = 0; i < size; i++)
|
fnd::SimpleTextOutput::hexDump(key, size, 0x10, 6);
|
||||||
{
|
|
||||||
if (i % 16 == 0)
|
|
||||||
{
|
|
||||||
printf("\n ");
|
|
||||||
}
|
|
||||||
printf("%02X%s", key[i], (i + 1 != size) ? "" : "\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printf(" Version: v%d\n", body.getTicketVersion());
|
printf(" Version: v%d\n", body.getTicketVersion());
|
||||||
printf(" License Type: %s\n", kLicenseType[body.getLicenseType()].c_str());
|
printf(" License Type: %s\n", kLicenseType[body.getLicenseType()].c_str());
|
||||||
|
@ -85,18 +73,12 @@ int main(int argc, char** argv)
|
||||||
printf(" PreInstall: %s\n", kBooleanStr[body.isPreInstall()].c_str());
|
printf(" PreInstall: %s\n", kBooleanStr[body.isPreInstall()].c_str());
|
||||||
printf(" SharedTitle: %s\n", kBooleanStr[body.isSharedTitle()].c_str());
|
printf(" SharedTitle: %s\n", kBooleanStr[body.isSharedTitle()].c_str());
|
||||||
printf(" AllContent: %s\n", kBooleanStr[body.allowAllContent()].c_str());
|
printf(" AllContent: %s\n", kBooleanStr[body.allowAllContent()].c_str());
|
||||||
printf(" Reserved Region:");
|
printf(" Reserved Region:\n");
|
||||||
for (uint32_t i = 0; i < 8; i++)
|
fnd::SimpleTextOutput::hexDump(body.getReservedRegion(), 8, 0x10, 4);
|
||||||
{
|
|
||||||
if (i % 16 == 0)
|
|
||||||
{
|
|
||||||
printf("\n ");
|
|
||||||
}
|
|
||||||
printf("%02X%s", body.getReservedRegion()[i], (i + 1 != 8) ? "" : "\n");
|
|
||||||
}
|
|
||||||
printf(" TicketId: 0x%016" PRIx64 "\n", body.getTicketId());
|
printf(" TicketId: 0x%016" PRIx64 "\n", body.getTicketId());
|
||||||
printf(" DeviceId: 0x%016" PRIx64 "\n", body.getDeviceId());
|
printf(" DeviceId: 0x%016" PRIx64 "\n", body.getDeviceId());
|
||||||
|
printf(" RightsId: ");
|
||||||
|
fnd::SimpleTextOutput::hexDump(body.getRightsId(), 16);
|
||||||
|
|
||||||
} catch (const fnd::Exception& e)
|
} catch (const fnd::Exception& e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue