FirmwareKit.OzipReader 0.1.0

dotnet add package FirmwareKit.OzipReader --version 0.1.0
                    
NuGet\Install-Package FirmwareKit.OzipReader -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FirmwareKit.OzipReader" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FirmwareKit.OzipReader" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="FirmwareKit.OzipReader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FirmwareKit.OzipReader --version 0.1.0
                    
#r "nuget: FirmwareKit.OzipReader, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FirmwareKit.OzipReader@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FirmwareKit.OzipReader&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=FirmwareKit.OzipReader&version=0.1.0
                    
Install as a Cake Tool

FirmwareKit.OzipReader

NuGet License: MIT

Oppo OZIP 加密固件解析库,支持解密和提取 OZIP 加密固件包内容。

功能特性

  • 元数据读取:解析 OZIP 头部信息、条目数量、密钥标识等
  • 自动解密:检测并使用正确的 AES-128-ECB 密钥解密
  • 条目解析:枚举解密后 ZIP 内部的所有文件条目
  • 数据提取:完整解密并提取固件包内容
  • 内置密钥数据库:支持多种 Oppo 设备的自动解密
  • 密钥暴力破解:支持未知密钥的暴力枚举破解

支持的固件格式

格式 扩展名 加密算法 说明
OZIP .ozip AES-128-ECB Oppo 加密 ZIP 固件

安装说明

dotnet add package FirmwareKit.OzipReader

快速开始

读取固件元数据

using FirmwareKit.OzipReader;

// 从文件读取
var metadata = OzipReader.ReadMetadata("firmware.ozip");
Console.WriteLine($"条目数: {metadata.EntryCount}");
Console.WriteLine($"密钥标识: {metadata.KeyId}");

// 从流读取
using var stream = File.OpenRead("firmware.ozip");
var metadataFromStream = OzipReader.ReadMetadataFromStream(stream);

解析条目列表(自动解密)

using var stream = File.OpenRead("firmware.ozip");
var archive = OzipReader.Parse(stream);

foreach (var entry in archive.Entries)
{
    Console.WriteLine($"{entry.Name} - {entry.Size} bytes");
}

提取固件内容

var options = new OppExtractOptions
{
    OutputDirectory = "./output",
    Overwrite = true
};

var result = OzipReader.Extract("firmware.ozip", "./output", options);
Console.WriteLine($"提取完成: {result.SuccessfullyExtracted}/{result.TotalEntries}");

工作原理

OZIP 文件使用 AES-128-ECB 加密,每 16KB 数据块中:

  • 前 16 字节为加密数据
  • 剩余 0x3FF0 字节为明文

解密过程:

  1. 读取加密数据的前 16 字节
  2. 使用内置密钥数据库尝试解密
  3. 验证解密结果是否以有效魔术字节开头(PK\x03\x04、AVB0 或 ANDR)
  4. 使用正确的密钥解密整个文件

API 参考

核心类

说明
OzipReader 静态入口,提供 ReadMetadataParseExtract 等方法
OzipArchive 固件归档对象,包含条目集合
OzipEntry 单个文件条目
OzipMetadata 固件元信息

加密提供者

// 使用内置密钥自动解密
var provider = new OzipFormatCryptoProvider();
var decryptedData = provider.AutoDecrypt(encryptedData);

// 使用指定密钥解密
var decryptedData = provider.Decrypt(encryptedData, "KEY_ID");

系统要求

  • .NET 8.0 或更高版本
  • .NET Standard 2.0 / 2.1

相关链接

许可证

本项目采用 MIT 许可证开源。详见 LICENSE 文件。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FirmwareKit.OzipReader:

Package Downloads
FirmwareKit.Oppo

Oppo firmware decryption and parsing library (meta-package). Install this to get all format support, or install individual packages (FirmwareKit.OfpReader, FirmwareKit.OpsReader, FirmwareKit.OzipReader) for specific formats.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 132 6/11/2026