From 008c76a82d1b5bad07d649da20af0797af6fc319 Mon Sep 17 00:00:00 2001 From: jakcron Date: Sat, 16 Oct 2021 16:00:17 +0800 Subject: [PATCH] Rename PkiCertProcess to EsCertProcess --- build/visualstudio/nstool/nstool.vcxproj | 4 +- .../nstool/nstool.vcxproj.filters | 48 +++++++-------- src/{PkiCertProcess.cpp => EsCertProcess.cpp} | 32 +++++----- src/{PkiCertProcess.h => EsCertProcess.h} | 4 +- src/Settings.cpp | 4 +- src/Settings.h | 2 +- src/main.cpp | 59 +------------------ 7 files changed, 50 insertions(+), 103 deletions(-) rename src/{PkiCertProcess.cpp => EsCertProcess.cpp} (86%) rename src/{PkiCertProcess.h => EsCertProcess.h} (95%) diff --git a/build/visualstudio/nstool/nstool.vcxproj b/build/visualstudio/nstool/nstool.vcxproj index 309584a..e9bac82 100644 --- a/build/visualstudio/nstool/nstool.vcxproj +++ b/build/visualstudio/nstool/nstool.vcxproj @@ -156,6 +156,7 @@ + @@ -168,7 +169,6 @@ - @@ -182,6 +182,7 @@ + @@ -195,7 +196,6 @@ - diff --git a/build/visualstudio/nstool/nstool.vcxproj.filters b/build/visualstudio/nstool/nstool.vcxproj.filters index f8362e7..9af3240 100644 --- a/build/visualstudio/nstool/nstool.vcxproj.filters +++ b/build/visualstudio/nstool/nstool.vcxproj.filters @@ -27,6 +27,9 @@ Header Files + + Header Files + Header Files @@ -63,9 +66,6 @@ Header Files - - Header Files - Header Files @@ -101,6 +101,9 @@ Source Files + + Source Files + Source Files @@ -110,15 +113,33 @@ Source Files + + Source Files + Source Files + + Source Files + Source Files + + Source Files + Source Files + + Source Files + + + Source Files + + + Source Files + Source Files @@ -140,26 +161,5 @@ Source Files - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - \ No newline at end of file diff --git a/src/PkiCertProcess.cpp b/src/EsCertProcess.cpp similarity index 86% rename from src/PkiCertProcess.cpp rename to src/EsCertProcess.cpp index 6ddb2b1..8671003 100644 --- a/src/PkiCertProcess.cpp +++ b/src/EsCertProcess.cpp @@ -1,18 +1,18 @@ -#include "PkiCertProcess.h" +#include "EsCertProcess.h" #include "PkiValidator.h" #include "util.h" #include -nstool::PkiCertProcess::PkiCertProcess() : - mModuleName("nstool::PkiCertProcess"), +nstool::EsCertProcess::EsCertProcess() : + mModuleName("nstool::EsCertProcess"), mFile(), mCliOutputMode(true, false, false, false), mVerify(false) { } -void nstool::PkiCertProcess::process() +void nstool::EsCertProcess::process() { importCerts(); @@ -23,27 +23,27 @@ void nstool::PkiCertProcess::process() displayCerts(); } -void nstool::PkiCertProcess::setInputFile(const std::shared_ptr& file) +void nstool::EsCertProcess::setInputFile(const std::shared_ptr& file) { mFile = file; } -void nstool::PkiCertProcess::setKeyCfg(const KeyBag& keycfg) +void nstool::EsCertProcess::setKeyCfg(const KeyBag& keycfg) { mKeyCfg = keycfg; } -void nstool::PkiCertProcess::setCliOutputMode(CliOutputMode mode) +void nstool::EsCertProcess::setCliOutputMode(CliOutputMode mode) { mCliOutputMode = mode; } -void nstool::PkiCertProcess::setVerifyMode(bool verify) +void nstool::EsCertProcess::setVerifyMode(bool verify) { mVerify = verify; } -void nstool::PkiCertProcess::importCerts() +void nstool::EsCertProcess::importCerts() { if (mFile == nullptr) { @@ -74,7 +74,7 @@ void nstool::PkiCertProcess::importCerts() } } -void nstool::PkiCertProcess::validateCerts() +void nstool::EsCertProcess::validateCerts() { PkiValidator pki; @@ -90,7 +90,7 @@ void nstool::PkiCertProcess::validateCerts() } } -void nstool::PkiCertProcess::displayCerts() +void nstool::EsCertProcess::displayCerts() { for (size_t i = 0; i < mCert.size(); i++) { @@ -98,9 +98,9 @@ void nstool::PkiCertProcess::displayCerts() } } -void nstool::PkiCertProcess::displayCert(const nn::pki::SignedData& cert) +void nstool::EsCertProcess::displayCert(const nn::pki::SignedData& cert) { - fmt::print("[NNPKI Certificate]\n"); + fmt::print("[ES Certificate]\n"); fmt::print(" SignType {:s}", getSignTypeStr(cert.getSignature().getSignType())); if (mCliOutputMode.show_extended_info) @@ -171,7 +171,7 @@ void nstool::PkiCertProcess::displayCert(const nn::pki::SignedData& args, const std::vector& obj.process(); } - else if (set.infile.filetype == nstool::Settings::FILE_TYPE_PKI_CERT) + else if (set.infile.filetype == nstool::Settings::FILE_TYPE_ES_CERT) { - nstool::PkiCertProcess obj; + nstool::EsCertProcess obj; obj.setInputFile(infile_stream); obj.setKeyCfg(set.opt.keybag); @@ -215,59 +215,6 @@ int umain(const std::vector& args, const std::vector& obj.process(); } - - switch (set.infile.filetype) - { - case nstool::Settings::FILE_TYPE_GAMECARD : - fmt::print("## FILE_TYPE_GAMECARD ##\n"); - break; - case nstool::Settings::FILE_TYPE_NSP : - fmt::print("## FILE_TYPE_NSP ##\n"); - break; - case nstool::Settings::FILE_TYPE_PARTITIONFS : - fmt::print("## FILE_TYPE_PARTITIONFS ##\n"); - break; - case nstool::Settings::FILE_TYPE_ROMFS : - fmt::print("## FILE_TYPE_ROMFS ##\n"); - break; - case nstool::Settings::FILE_TYPE_NCA : - fmt::print("## FILE_TYPE_NCA ##\n"); - break; - case nstool::Settings::FILE_TYPE_META : - fmt::print("## FILE_TYPE_META ##\n"); - break; - case nstool::Settings::FILE_TYPE_CNMT : - fmt::print("## FILE_TYPE_CNMT ##\n"); - break; - case nstool::Settings::FILE_TYPE_NSO : - fmt::print("## FILE_TYPE_NSO ##\n"); - break; - case nstool::Settings::FILE_TYPE_NRO : - fmt::print("## FILE_TYPE_NRO ##\n"); - break; - case nstool::Settings::FILE_TYPE_NACP : - fmt::print("## FILE_TYPE_NACP ##\n"); - break; - case nstool::Settings::FILE_TYPE_INI : - fmt::print("## FILE_TYPE_INI ##\n"); - break; - case nstool::Settings::FILE_TYPE_KIP : - fmt::print("## FILE_TYPE_KIP ##\n"); - break; - case nstool::Settings::FILE_TYPE_PKI_CERT : - fmt::print("## FILE_TYPE_PKI_CERT ##\n"); - break; - case nstool::Settings::FILE_TYPE_ES_TIK : - fmt::print("## FILE_TYPE_ES_TIK ##\n"); - break; - case nstool::Settings::FILE_TYPE_HB_ASSET : - fmt::print("## FILE_TYPE_HB_ASSET ##\n"); - break; - default: - fmt::print("## unknown({}) ##\n", (int)set.infile.filetype); - break; - } - } catch (tc::Exception& e) {