Rename PkiCertProcess to EsCertProcess

This commit is contained in:
jakcron 2021-10-16 16:00:17 +08:00
parent 836a85f71e
commit 008c76a82d
7 changed files with 50 additions and 103 deletions

View file

@ -156,6 +156,7 @@
<ClInclude Include="..\..\..\src\CnmtProcess.h" />
<ClInclude Include="..\..\..\src\elf.h" />
<ClInclude Include="..\..\..\src\ElfSymbolParser.h" />
<ClInclude Include="..\..\..\src\EsCertProcess.h" />
<ClInclude Include="..\..\..\src\EsTikProcess.h" />
<ClInclude Include="..\..\..\src\FsProcess.h" />
<ClInclude Include="..\..\..\src\GameCardProcess.h" />
@ -168,7 +169,6 @@
<ClInclude Include="..\..\..\src\NroProcess.h" />
<ClInclude Include="..\..\..\src\NsoProcess.h" />
<ClInclude Include="..\..\..\src\PfsProcess.h" />
<ClInclude Include="..\..\..\src\PkiCertProcess.h" />
<ClInclude Include="..\..\..\src\PkiValidator.h" />
<ClInclude Include="..\..\..\src\RoMetadataProcess.h" />
<ClInclude Include="..\..\..\src\RomfsProcess.h" />
@ -182,6 +182,7 @@
<ClCompile Include="..\..\..\src\AssetProcess.cpp" />
<ClCompile Include="..\..\..\src\CnmtProcess.cpp" />
<ClCompile Include="..\..\..\src\ElfSymbolParser.cpp" />
<ClCompile Include="..\..\..\src\EsCertProcess.cpp" />
<ClCompile Include="..\..\..\src\EsTikProcess.cpp" />
<ClCompile Include="..\..\..\src\FsProcess.cpp" />
<ClCompile Include="..\..\..\src\GameCardProcess.cpp" />
@ -195,7 +196,6 @@
<ClCompile Include="..\..\..\src\NroProcess.cpp" />
<ClCompile Include="..\..\..\src\NsoProcess.cpp" />
<ClCompile Include="..\..\..\src\PfsProcess.cpp" />
<ClCompile Include="..\..\..\src\PkiCertProcess.cpp" />
<ClCompile Include="..\..\..\src\PkiValidator.cpp" />
<ClCompile Include="..\..\..\src\RoMetadataProcess.cpp" />
<ClCompile Include="..\..\..\src\RomfsProcess.cpp" />

View file

@ -27,6 +27,9 @@
<ClInclude Include="..\..\..\src\ElfSymbolParser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\EsCertProcess.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\EsTikProcess.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -63,9 +66,6 @@
<ClInclude Include="..\..\..\src\PfsProcess.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\PkiCertProcess.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\PkiValidator.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -101,6 +101,9 @@
<ClCompile Include="..\..\..\src\ElfSymbolParser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\EsCertProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\EsTikProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -110,15 +113,33 @@
<ClCompile Include="..\..\..\src\GameCardProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\IniProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\KeyBag.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\KipProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\MetaProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NacpProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NcaProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NsoProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NroProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\PfsProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -140,26 +161,5 @@
<ClCompile Include="..\..\..\src\util.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\PkiCertProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NsoProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NroProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\MetaProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\IniProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\KipProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\NcaProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,18 +1,18 @@
#include "PkiCertProcess.h"
#include "EsCertProcess.h"
#include "PkiValidator.h"
#include "util.h"
#include <nn/pki/SignUtils.h>
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<tc::io::IStream>& file)
void nstool::EsCertProcess::setInputFile(const std::shared_ptr<tc::io::IStream>& 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<nn::pki::CertificateBody>& cert)
void nstool::EsCertProcess::displayCert(const nn::pki::SignedData<nn::pki::CertificateBody>& 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<nn::pki::Cert
}
}
std::string nstool::PkiCertProcess::getSignTypeStr(nn::pki::sign::SignatureId type) const
std::string nstool::EsCertProcess::getSignTypeStr(nn::pki::sign::SignatureId type) const
{
std::string str;
switch (type)
@ -201,12 +201,12 @@ std::string nstool::PkiCertProcess::getSignTypeStr(nn::pki::sign::SignatureId ty
return str;
}
std::string nstool::PkiCertProcess::getEndiannessStr(bool isLittleEndian) const
std::string nstool::EsCertProcess::getEndiannessStr(bool isLittleEndian) const
{
return isLittleEndian ? "LittleEndian" : "BigEndian";
}
std::string nstool::PkiCertProcess::getPublicKeyTypeStr(nn::pki::cert::PublicKeyType type) const
std::string nstool::EsCertProcess::getPublicKeyTypeStr(nn::pki::cert::PublicKeyType type) const
{
std::string str;
switch (type)

View file

@ -7,10 +7,10 @@
namespace nstool {
class PkiCertProcess
class EsCertProcess
{
public:
PkiCertProcess();
EsCertProcess();
void process();

View file

@ -292,7 +292,7 @@ public:
}
else if (params[0] == "cert")
{
mParam = nstool::Settings::FILE_TYPE_PKI_CERT;
mParam = nstool::Settings::FILE_TYPE_ES_CERT;
}
else if (params[0] == "tik")
{
@ -665,7 +665,7 @@ void nstool::SettingsInitializer::determine_filetype()
// detect Certificate
else if (determineValidEsCertFromSample(raw_data))
{
infile.filetype = FILE_TYPE_PKI_CERT;
infile.filetype = FILE_TYPE_ES_CERT;
}
// detect Ticket
else if (determineValidEsTikFromSample(raw_data))

View file

@ -26,7 +26,7 @@ struct Settings
FILE_TYPE_NACP,
FILE_TYPE_INI,
FILE_TYPE_KIP,
FILE_TYPE_PKI_CERT,
FILE_TYPE_ES_CERT,
FILE_TYPE_ES_TIK,
FILE_TYPE_HB_ASSET,
};

View file

@ -14,7 +14,7 @@
#include "NacpProcess.h"
#include "IniProcess.h"
#include "KipProcess.h"
#include "PkiCertProcess.h"
#include "EsCertProcess.h"
#include "EsTikProcess.h"
#include "AssetProcess.h"
@ -174,9 +174,9 @@ int umain(const std::vector<std::string>& args, const std::vector<std::string>&
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<std::string>& args, const std::vector<std::string>&
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)
{