2018-06-27 05:03:46 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
|
|
|
#include <fnd/List.h>
|
2018-10-14 05:45:09 +00:00
|
|
|
#include <fnd/IByteModel.h>
|
2018-10-22 13:30:49 +00:00
|
|
|
#include <nn/hac/define/aci.h>
|
|
|
|
#include <nn/hac/FileSystemAccessControl.h>
|
|
|
|
#include <nn/hac/ServiceAccessControl.h>
|
|
|
|
#include <nn/hac/KernelCapabilityControl.h>
|
2018-06-27 05:03:46 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
namespace nn
|
|
|
|
{
|
|
|
|
namespace hac
|
2018-06-27 05:03:46 +00:00
|
|
|
{
|
2018-10-18 12:52:43 +00:00
|
|
|
class AccessControlInfoDesc :
|
|
|
|
public fnd::IByteModel
|
2018-06-27 05:03:46 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-10-18 12:52:43 +00:00
|
|
|
AccessControlInfoDesc();
|
|
|
|
AccessControlInfoDesc(const AccessControlInfoDesc& other);
|
2018-06-27 05:03:46 +00:00
|
|
|
|
2018-10-18 12:52:43 +00:00
|
|
|
void operator=(const AccessControlInfoDesc& other);
|
|
|
|
bool operator==(const AccessControlInfoDesc& other) const;
|
|
|
|
bool operator!=(const AccessControlInfoDesc& other) const;
|
2018-06-27 05:03:46 +00:00
|
|
|
|
2018-10-18 12:52:43 +00:00
|
|
|
// IByteModel
|
2018-06-27 05:03:46 +00:00
|
|
|
void toBytes();
|
|
|
|
void fromBytes(const byte_t* data, size_t len);
|
|
|
|
const fnd::Vec<byte_t>& getBytes() const;
|
|
|
|
|
2018-08-07 08:35:03 +00:00
|
|
|
void generateSignature(const fnd::rsa::sRsa2048Key& key);
|
|
|
|
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
|
2018-06-27 05:03:46 +00:00
|
|
|
|
|
|
|
// variables
|
|
|
|
void clear();
|
|
|
|
|
2018-08-07 08:35:03 +00:00
|
|
|
const fnd::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
|
|
|
|
void setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
|
2018-06-27 05:03:46 +00:00
|
|
|
|
|
|
|
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-10-22 13:30:49 +00:00
|
|
|
const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const;
|
|
|
|
void setFileSystemAccessControl(const FileSystemAccessControl& fac);
|
2018-06-27 05:03:46 +00:00
|
|
|
|
2018-10-22 13:30:49 +00:00
|
|
|
const nn::hac::ServiceAccessControl& getServiceAccessControl() const;
|
|
|
|
void setServiceAccessControl(const ServiceAccessControl& sac);
|
2018-06-27 05:03:46 +00:00
|
|
|
|
2018-10-22 13:30:49 +00:00
|
|
|
const nn::hac::KernelCapabilityControl& getKernelCapabilities() const;
|
|
|
|
void setKernelCapabilities(const KernelCapabilityControl& kc);
|
2018-06-27 05:03:46 +00:00
|
|
|
private:
|
|
|
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
|
|
|
|
|
|
|
// raw data
|
|
|
|
fnd::Vec<byte_t> mRawBinary;
|
|
|
|
|
|
|
|
// variables
|
2018-08-07 08:35:03 +00:00
|
|
|
fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key;
|
2018-06-27 05:03:46 +00:00
|
|
|
fnd::List<aci::Flag> mFlags;
|
|
|
|
sProgramIdRestrict mProgramIdRestrict;
|
2018-10-22 13:30:49 +00:00
|
|
|
nn::hac::FileSystemAccessControl mFileSystemAccessControl;
|
|
|
|
nn::hac::ServiceAccessControl mServiceAccessControl;
|
|
|
|
nn::hac::KernelCapabilityControl mKernelCapabilities;
|
2018-06-27 05:03:46 +00:00
|
|
|
};
|
2018-08-07 07:17:51 +00:00
|
|
|
}
|
2018-06-27 05:03:46 +00:00
|
|
|
}
|