Generalize QuickDecryptor

This commit is contained in:
Pengfei
2021-07-31 17:25:56 +08:00
parent 7115c30f76
commit 75f79e10d1
5 changed files with 74 additions and 45 deletions
+6 -5
View File
@@ -59,14 +59,15 @@ bool SDMCDecryptor::DecryptAndWriteFile(const std::string& source, const std::st
return false;
}
auto key = Key::GetNormalKey(Key::SDKey);
auto ctr = GetFileCTR(source);
quick_decryptor.SetCrypto(CreateCTRCrypto(key, ctr));
auto source_file = std::make_shared<FileUtil::IOFile>(root_folder + source, "rb");
auto size = source_file->GetSize();
auto destination_file = std::make_shared<FileUtil::IOFile>(destination, "wb");
auto key = Key::GetNormalKey(Key::SDKey);
auto ctr = GetFileCTR(source);
return quick_decryptor.DecryptAndWriteFile(std::move(source_file), size,
std::move(destination_file), callback, true,
std::move(key), std::move(ctr));
return quick_decryptor.CryptAndWriteFile(std::move(source_file), size,
std::move(destination_file), callback);
}
void SDMCDecryptor::Abort() {