// Copyright 2018 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include #include #include #include #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" namespace Loader { enum class ResultStatus; } namespace FileSys { class Ticket { public: #pragma pack(push, 1) struct Body { std::array issuer; std::array ecc_public_key; u8 version; u8 ca_crl_version; u8 signer_crl_version; std::array title_key; INSERT_PADDING_BYTES(1); u64_be ticket_id; u32_be console_id; u64_be title_id; INSERT_PADDING_BYTES(2); u16_be ticket_title_version; INSERT_PADDING_BYTES(8); u8 license_type; u8 common_key_index; INSERT_PADDING_BYTES(0x2A); u32_be eshop_account_id; INSERT_PADDING_BYTES(1); u8 audit; INSERT_PADDING_BYTES(0x42); std::array limits; std::array content_index; }; static_assert(sizeof(Body) == 0x210, "Ticket body structure size is wrong"); #pragma pack(pop) Loader::ResultStatus Load(const std::vector file_data, std::size_t offset = 0); boost::optional> GetTitleKey() const; private: Body ticket_body; u32_be signature_type; std::vector ticket_signature; }; } // namespace FileSys