Example #1
0
bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
{
	// Set empty RAP key.
	u8 rap_key[0x10];
	memset(rap_key, 0, 0x10);

	// Try to find a matching RAP file under dev_usb000.
	std::string ci_str((const char *)content_id);
	std::string rap_path(fmt::ToUTF8(wxGetCwd()) + "/dev_usb000/" + ci_str + ".rap");

	// Check if we have a valid RAP file.
	if (!wxFile::Exists(fmt::FromUTF8(rap_path)))
	{
		ConLog.Error("This application requires a valid RAP file for decryption!");
		return false;
	}

	// Open the RAP file and read the key.
	wxFile rap_file(fmt::FromUTF8(rap_path), wxFile::read);

	if (!rap_file.IsOpened())
	{
		ConLog.Error("Failed to load RAP file!");
		return false;
	}

	ConLog.Write("Loading RAP file %s", (ci_str + ".rap").c_str());
	rap_file.Read(rap_key, 0x10);
	rap_file.Close();

	// Convert the RAP key.
	rap_to_rif(rap_key, npdrm_key);

	return true;
}
Example #2
0
bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
{
	// Set empty RAP key.
	u8 rap_key[0x10];
	memset(rap_key, 0, 0x10);

	// Try to find a matching RAP file under exdata folder.
	std::string ci_str((const char *)content_id);
	std::string pf_str("00000001");  // TODO: Allow multiple profiles. Use default for now.
	std::string rap_path("dev_hdd0/home/" + pf_str + "/exdata/" + ci_str + ".rap");

	// Check if we have a valid RAP file.
	if (!fs::is_file(rap_path))
	{
		LOG_ERROR(LOADER, "This application requires a valid RAP file for decryption!");
		return false;
	}

	// Open the RAP file and read the key.
	fs::file rap_file(rap_path);

	if (!rap_file)
	{
		LOG_ERROR(LOADER, "Failed to load RAP file!");
		return false;
	}

	LOG_NOTICE(LOADER, "Loading RAP file %s.rap", ci_str);
	rap_file.read(rap_key, 0x10);

	// Convert the RAP key.
	rap_to_rif(rap_key, npdrm_key);

	return true;
}
Example #3
0
bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
{
	// Set empty RAP key.
	u8 rap_key[0x10];
	memset(rap_key, 0, 0x10);

	// Try to find a matching RAP file under dev_usb000.
	std::string ci_str((const char *)content_id);
	// TODO: This shouldn't use current dir
	std::string rap_path("./dev_usb000/" + ci_str + ".rap");

	// Check if we have a valid RAP file.
	if (!rExists(rap_path))
	{
		LOG_ERROR(LOADER, "This application requires a valid RAP file for decryption!");
		return false;
	}

	// Open the RAP file and read the key.
	rFile rap_file(rap_path, rFile::read);

	if (!rap_file.IsOpened())
	{
		LOG_ERROR(LOADER, "Failed to load RAP file!");
		return false;
	}

	LOG_NOTICE(LOADER, "Loading RAP file %s", (ci_str + ".rap").c_str());
	rap_file.Read(rap_key, 0x10);
	rap_file.Close();

	// Convert the RAP key.
	rap_to_rif(rap_key, npdrm_key);

	return true;
}