nstool/lib/libhac/include/nn/hac/AccessControlInfoDescBinary.h

91 lines
2.6 KiB
C
Raw Permalink Normal View History

#pragma once
#include <string>
#include <fnd/types.h>
#include <fnd/List.h>
#include <fnd/ISerialisable.h>
2018-08-07 07:17:51 +00:00
#include <nn/hac/aci.h>
#include <nn/hac/FileSystemAccessControlBinary.h>
#include <nn/hac/ServiceAccessControlBinary.h>
#include <nn/hac/KernelCapabilityBinary.h>
2018-08-07 07:17:51 +00:00
namespace nn
{
namespace hac
{
class AccessControlInfoDescBinary : public fnd::ISerialisable
{
public:
struct sProgramIdRestrict
{
uint64_t min;
uint64_t max;
void operator=(const sProgramIdRestrict& other)
{
min = other.min;
max = other.max;
}
bool operator==(const sProgramIdRestrict& other) const
{
return (min == other.min) \
&& (max == other.max);
}
bool operator!=(const sProgramIdRestrict& other) const
{
return !(*this == other);
}
};
AccessControlInfoDescBinary();
AccessControlInfoDescBinary(const AccessControlInfoDescBinary& other);
void operator=(const AccessControlInfoDescBinary& other);
bool operator==(const AccessControlInfoDescBinary& other) const;
bool operator!=(const AccessControlInfoDescBinary& other) const;
// export/import binary
void toBytes();
void fromBytes(const byte_t* data, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
void generateSignature(const fnd::rsa::sRsa2048Key& key);
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
// variables
void clear();
const fnd::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
void setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
const fnd::List<aci::Flag>& getFlagList() const;
void setFlagList(const fnd::List<aci::Flag>& flags);
const sProgramIdRestrict& getProgramIdRestrict() const;
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
2018-08-07 07:17:51 +00:00
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
2018-08-07 07:17:51 +00:00
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
2018-06-29 04:00:15 +00:00
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
2018-08-07 07:17:51 +00:00
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
void setKernelCapabilities(const KernelCapabilityBinary& kc);
private:
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
// raw data
fnd::Vec<byte_t> mRawBinary;
// variables
fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key;
fnd::List<aci::Flag> mFlags;
sProgramIdRestrict mProgramIdRestrict;
2018-08-07 07:17:51 +00:00
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
nn::hac::KernelCapabilityBinary mKernelCapabilities;
};
2018-08-07 07:17:51 +00:00
}
}