Add CIABuildType to CIABuilder; Add legit ticket handling

This commit is contained in:
Pengfei
2021-07-29 16:38:41 +08:00
parent 325832f318
commit 502e05dc2b
3 changed files with 45 additions and 8 deletions
+11 -2
View File
@@ -25,6 +25,12 @@ constexpr std::size_t CIA_METADATA_SIZE = 0x3AC0;
struct Config;
class HashedFile;
enum class CIABuildType {
Standard, /// Decrypted CIA with generalized ticket
PirateLegit, /// Uses legit TMD and encryption, but with generalized ticket
Legit, /// Fully legit, with personal ticket containing console ID and eshop account
};
class CIABuilder {
public:
explicit CIABuilder();
@@ -34,8 +40,9 @@ public:
* Initializes the building of the CIA.
* @return true on success, false otherwise
*/
bool Init(const std::string& destination, TitleMetadata tmd, const Config& config,
std::size_t total_size, const Common::ProgressCallback& callback);
bool Init(CIABuildType type, const std::string& destination, TitleMetadata tmd,
const Config& config, std::size_t total_size,
const Common::ProgressCallback& callback);
/**
* Adds an NCCH content to the CIA.
@@ -93,6 +100,8 @@ private:
bool WriteCert(const std::string& certs_db_path);
bool WriteTicket(const std::string& ticket_db_path, const std::string& enc_title_keys_bin_path);
CIABuildType type;
Header header{};
Metadata meta{};