From 82d6db8e349a520a1697cabdfa1f6f836d772dc0 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 10 Mar 2020 19:21:49 +0800 Subject: [PATCH] Add support in UserSettings for outputting NCA/ACID key generations. --- src/UserSettings.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/UserSettings.cpp b/src/UserSettings.cpp index 16542d5..9ad678a 100644 --- a/src/UserSettings.cpp +++ b/src/UserSettings.cpp @@ -912,10 +912,14 @@ void UserSettings::dumpKeyConfig() const std::cout << "[KeyConfiguration]" << std::endl; std::cout << " NCA Keys:" << std::endl; - if (mKeyCfg.getContentArchiveHeader0SignKey(rsa2048_key, 0x00) == true) - dumpRsa2048Key(rsa2048_key, "Header Signature[0] Key", 2); + for (size_t i = 0; i < kMasterKeyNum; i++) + { + if (mKeyCfg.getContentArchiveHeader0SignKey(rsa2048_key, i) == true) + dumpRsa2048Key(rsa2048_key, "Header0-SignatureKey-" + kKeyIndex[i], 2); + } + if (mKeyCfg.getContentArchiveHeaderKey(aesxts_key) == true) - dumpAesXtsKey(aesxts_key, "Header Encryption Key", 2); + dumpAesXtsKey(aesxts_key, "Header-EncryptionKey", 2); for (size_t i = 0; i < kMasterKeyNum; i++) { @@ -939,14 +943,15 @@ void UserSettings::dumpKeyConfig() const std::cout << " XCI Keys:" << std::endl; if (mKeyCfg.getXciHeaderSignKey(rsa2048_key) == true) - dumpRsa2048Key(rsa2048_key, "Header Signature Key", 2); + dumpRsa2048Key(rsa2048_key, "Header-SignatureKey", 2); if (mKeyCfg.getXciHeaderKey(aes_key) == true) - dumpAesKey(aes_key, "Extended Header Encryption Key", 2); - - - if (mKeyCfg.getAcidSignKey(rsa2048_key, 0x00) == true) - dumpRsa2048Key(rsa2048_key, "ACID Signer Key", 1); + dumpAesKey(aes_key, "ExtendedHeader-EncryptionKey", 2); + for (size_t i = 0; i < kMasterKeyNum; i++) + { + if (mKeyCfg.getAcidSignKey(rsa2048_key, i) == true) + dumpRsa2048Key(rsa2048_key, "ACID-SignatureKey-" + kKeyIndex[i], 1); + } std::cout << " Package1 Keys:" << std::endl; for (size_t i = 0; i < kMasterKeyNum; i++)