|
|
|
@ -15,8 +15,9 @@
|
|
|
|
|
#include "common/hex_util.h"
|
|
|
|
|
#include "common/string_util.h"
|
|
|
|
|
#include "core/crypto/aes_util.h"
|
|
|
|
|
#include "core/crypto/key_manager.h"
|
|
|
|
|
#include "core/crypto/xts_encryption_layer.h"
|
|
|
|
|
#include "core/file_sys/partition_filesystem.h"
|
|
|
|
|
#include "core/file_sys/content_archive.h"
|
|
|
|
|
#include "core/file_sys/vfs_offset.h"
|
|
|
|
|
#include "core/file_sys/xts_archive.h"
|
|
|
|
|
#include "core/loader/loader.h"
|
|
|
|
@ -43,7 +44,9 @@ static bool CalculateHMAC256(Destination* out, const SourceKey* key, std::size_t
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NAX::NAX(VirtualFile file_) : header(std::make_unique<NAXHeader>()), file(std::move(file_)) {
|
|
|
|
|
NAX::NAX(VirtualFile file_)
|
|
|
|
|
: header(std::make_unique<NAXHeader>()),
|
|
|
|
|
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
|
|
|
|
|
std::string path = Common::FS::SanitizePath(file->GetFullPath());
|
|
|
|
|
static const std::regex nax_path_regex("/registered/(000000[0-9A-F]{2})/([0-9A-F]{32})\\.nca",
|
|
|
|
|
std::regex_constants::ECMAScript |
|
|
|
|
@ -60,7 +63,8 @@ NAX::NAX(VirtualFile file_) : header(std::make_unique<NAXHeader>()), file(std::m
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
|
|
|
|
|
: header(std::make_unique<NAXHeader>()), file(std::move(file_)) {
|
|
|
|
|
: header(std::make_unique<NAXHeader>()),
|
|
|
|
|
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
|
|
|
|
|
Core::Crypto::SHA256Hash hash{};
|
|
|
|
|
mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
|
|
|
|
|
status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0],
|
|
|
|
|