mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:35:12 +01:00
Add support for XCI titlekey decryption
This commit is contained in:
parent
666df1eb43
commit
77d8d1bee1
@ -36,7 +36,7 @@ namespace skyline::loader {
|
||||
continue;
|
||||
|
||||
try {
|
||||
auto nca{vfs::NCA(secure->OpenFile(entry.name), keyStore)};
|
||||
auto nca{vfs::NCA(secure->OpenFile(entry.name), keyStore, true)};
|
||||
|
||||
if (nca.contentType == vfs::NcaContentType::Program && nca.romFs != nullptr && nca.exeFs != nullptr)
|
||||
programNca = std::move(nca);
|
||||
|
@ -14,7 +14,7 @@
|
||||
namespace skyline::vfs {
|
||||
using namespace loader;
|
||||
|
||||
NCA::NCA(std::shared_ptr<vfs::Backing> pBacking, std::shared_ptr<crypto::KeyStore> pKeyStore) : backing(std::move(pBacking)), keyStore(std::move(pKeyStore)) {
|
||||
NCA::NCA(std::shared_ptr<vfs::Backing> pBacking, std::shared_ptr<crypto::KeyStore> pKeyStore, bool pUseKeyArea) : backing(std::move(pBacking)), keyStore(std::move(pKeyStore)), useKeyArea(pUseKeyArea) {
|
||||
header = backing->Read<NcaHeader>();
|
||||
|
||||
if (header.magic != util::MakeMagic<u32>("NCA3")) {
|
||||
@ -78,7 +78,7 @@ namespace skyline::vfs {
|
||||
return rawBacking;
|
||||
case NcaSectionEncryptionType::CTR:
|
||||
case NcaSectionEncryptionType::BKTR: {
|
||||
auto key{!rightsIdEmpty ? GetTitleKey() : GetKeyAreaKey(sectionHeader.encryptionType)};
|
||||
auto key{!(rightsIdEmpty || useKeyArea) ? GetTitleKey() : GetKeyAreaKey(sectionHeader.encryptionType)};
|
||||
|
||||
std::array<u8, 0x10> ctr{};
|
||||
u32 secureValueLE{__builtin_bswap32(sectionHeader.secureValue)};
|
||||
|
@ -173,6 +173,7 @@ namespace skyline {
|
||||
std::shared_ptr<crypto::KeyStore> keyStore;
|
||||
bool encrypted{false};
|
||||
bool rightsIdEmpty;
|
||||
bool useKeyArea;
|
||||
|
||||
void ReadPfs0(const NcaSectionHeader §ionHeader, const NcaFsEntry &entry);
|
||||
|
||||
@ -193,7 +194,7 @@ namespace skyline {
|
||||
std::shared_ptr<Backing> romFs; //!< The backing for this NCA's RomFS section
|
||||
NcaContentType contentType; //!< The content type of the NCA
|
||||
|
||||
NCA(std::shared_ptr<vfs::Backing> backing, std::shared_ptr<crypto::KeyStore> keyStore);
|
||||
NCA(std::shared_ptr<vfs::Backing> backing, std::shared_ptr<crypto::KeyStore> keyStore, bool useKeyArea = false);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user