nstool/lib/libes/include/es/TicketBody_V2.h

110 lines
2.7 KiB
C
Raw Normal View History

2018-06-06 12:38:42 +00:00
#pragma once
#include <string>
2018-06-24 04:46:11 +00:00
#include <fnd/ISerialisable.h>
2018-06-06 12:38:42 +00:00
#include <es/ticket.h>
namespace es
{
class TicketBody_V2 :
2018-06-24 04:46:11 +00:00
public fnd::ISerialisable
2018-06-06 12:38:42 +00:00
{
public:
TicketBody_V2();
TicketBody_V2(const TicketBody_V2& other);
void operator=(const TicketBody_V2& other);
2018-06-06 12:38:42 +00:00
bool operator==(const TicketBody_V2& other) const;
bool operator!=(const TicketBody_V2& other) const;
// export/import binary
2018-06-24 04:46:11 +00:00
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
2018-06-06 12:38:42 +00:00
// variables
2018-06-24 04:46:11 +00:00
void clear();
2018-06-06 12:38:42 +00:00
const std::string& getIssuer() const;
void setIssuer(const std::string& issuer);
const byte_t* getEncTitleKey() const;
void setEncTitleKey(const byte_t* data, size_t len);
ticket::TitleKeyEncType getTitleKeyEncType() const;
void setTitleKeyEncType(ticket::TitleKeyEncType type);
uint16_t getTicketVersion() const;
void setTicketVersion(uint16_t version);
ticket::LicenseType getLicenseType() const;
void setLicenseType(ticket::LicenseType type);
byte_t getCommonKeyId() const;
void setCommonKeyId(byte_t id);
bool isPreInstall() const;
void setIsPreInstall(bool isPreInstall);
bool isSharedTitle() const;
void setIsSharedTitle(bool isSharedTitle);
bool allowAllContent() const;
void setAllowAllContent(bool allowAllContent);
const byte_t* getReservedRegion() const;
void setReservedRegion(const byte_t* data, size_t len);
uint64_t getTicketId() const;
void setTicketId(uint64_t id);
uint64_t getDeviceId() const;
void setDeviceId(uint64_t id);
const byte_t* getRightsId() const;
void setRightsId(const byte_t* id);
uint32_t getAccountId() const;
void setAccountId(uint32_t id);
uint32_t getSectionTotalSize() const;
void setSectionTotalSize(uint32_t size);
uint32_t getSectionHeaderOffset() const;
void setSectionHeaderOffset(uint32_t offset);
uint16_t getSectionNum() const;
void setSectionNum(uint16_t num);
uint16_t getSectionEntrySize() const;
void setSectionEntrySize(uint16_t size);
private:
const std::string kModuleName = "TICKET_BODY_V2";
// raw binary
2018-06-24 04:46:11 +00:00
fnd::Vec<byte_t> mRawBinary;
2018-06-06 12:38:42 +00:00
// variables
std::string mIssuer;
byte_t mEncTitleKey[ticket::kEncTitleKeySize];
2018-06-23 03:32:12 +00:00
ticket::TitleKeyEncType mEncType;
2018-06-06 12:38:42 +00:00
uint16_t mTicketVersion;
ticket::LicenseType mLicenseType;
byte_t mCommonKeyId;
bool mPreInstall;
bool mSharedTitle;
bool mAllowAllContent;
byte_t mReservedRegion[ticket::kReservedRegionSize]; // explicitly reserved
uint64_t mTicketId;
uint64_t mDeviceId;
byte_t mRightsId[ticket::kRightsIdSize];
uint32_t mAccountId;
uint32_t mSectTotalSize;
uint32_t mSectHeaderOffset;
uint16_t mSectNum;
uint16_t mSectEntrySize;
};
}