FirmwareKit.NTPi 1.0.0

dotnet add package FirmwareKit.NTPi --version 1.0.0
                    
NuGet\Install-Package FirmwareKit.NTPi -Version 1.0.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.NTPi" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FirmwareKit.NTPi" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="FirmwareKit.NTPi" />
                    
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.NTPi --version 1.0.0
                    
#r "nuget: FirmwareKit.NTPi, 1.0.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.NTPi@1.0.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.NTPi&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=FirmwareKit.NTPi&version=1.0.0
                    
Install as a Cake Tool

FirmwareKit.NTPi

A .NET library for parsing, extracting, and creating Nothing Technology Package Image (NTPI) firmware files. Supports AES-256-CBC decryption, LZMA2 decompression, and SHA-256 integrity verification.

Features

  • Read NTPI firmware package metadata (version, regions, file entries)
  • Unpack NTPI firmware packages to disk with parallel file extraction
  • Parse NTPI firmware packages into memory for programmatic access
  • Pack files into NTPI firmware packages with parallel compression and encryption
  • AOT compatible — fully compatible with Native AOT publishing
  • Cross-platform — targets .NET 10/8, .NET Standard 2.1/2.0

Installation

dotnet add package FirmwareKit.NTPi

Quick Start

Reading firmware info

using FirmwareKit.NTPi;
using FirmwareKit.NTPi.Compression;
using FirmwareKit.NTPi.Crypto;

using var reader = new NtpiReader(new AesCbcCryptoProvider(), new Lzma2Compressor());
NtpiFileInfo info = reader.ReadInfo("firmware.ntpi");

Console.WriteLine($"Version: {info.MajorVersion}.{info.MinorVersion}.{info.PatchVersion}");
Console.WriteLine($"Files: {info.FileEntries.Count}");
foreach (var entry in info.FileEntries)
{
    Console.WriteLine($"  {entry.Name} ({entry.OriginalLength} bytes)");
}

Unpacking firmware

using var reader = new NtpiReader(new AesCbcCryptoProvider(), new Lzma2Compressor());

// Sequential extraction
reader.Unpack("firmware.ntpi", @"C:\output");

// Parallel extraction with progress reporting
var progress = new Progress<NtpiExtractionProgress>(p =>
    Console.WriteLine($"[{p.CompletedFiles}/{p.TotalFiles}] {p.CurrentFileName}"));
reader.Unpack("firmware.ntpi", @"C:\output", progress, maxDegreeOfParallelism: 4);

// Async with cancellation
await reader.UnpackAsync("firmware.ntpi", @"C:\output",
    cancellationToken: cancellationToken);

Parsing firmware into memory

using var reader = new NtpiReader(new AesCbcCryptoProvider(), new Lzma2Compressor());
NtpiParsedFile parsed = reader.Parse("firmware.ntpi");

foreach (var (name, data) in parsed.ExtractedFiles)
{
    Console.WriteLine($"{name}: {data.Length} bytes");
}

Packing firmware

using var writer = new NtpiWriter(new AesCbcCryptoProvider(), new Lzma2Compressor());

// Pack from directory
writer.Pack(@"C:\firmware_files", "output.ntpi", major: 1, minor: 3, patch: 0);

// Pack from pre-defined entries
var entries = new List<FileEntry> { new FileEntry { Name = "boot.img" } };
var fileData = new Dictionary<string, byte[]> { ["boot.img"] = File.ReadAllBytes("boot.img") };
writer.PackFromEntries(entries, fileData, "output.ntpi");

// Async with progress
var progress = new Progress<NtpiPackProgress>(p =>
    Console.WriteLine($"[{p.Phase}] {p.CompletedFiles}/{p.TotalFiles} {p.CurrentFileName}"));
await writer.PackAsync(@"C:\firmware_files", "output.ntpi", progress: progress);

Registering custom version keys

using FirmwareKit.NTPi.Models;

var keys = new Dictionary<int, NtpiVersionKey>
{
    [1] = new NtpiVersionKey(keyBytes1, ivBytes1),
    [2] = new NtpiVersionKey(keyBytes2, ivBytes2),
    [3] = new NtpiVersionKey(keyBytes3, ivBytes3),
    [4] = new NtpiVersionKey(keyBytes4, ivBytes4),
    [5] = new NtpiVersionKey(keyBytes5, ivBytes5)
};
NtpiVersionRegistry.RegisterVersion(1, 5, 0, keys);

Architecture

The library uses dependency injection for crypto and compression services:

  • ICryptoProvider — AES-256-CBC encryption/decryption abstraction
  • ILzma2Compressor — LZMA2 compression/decompression abstraction

Default implementations (AesCbcCryptoProvider, Lzma2Compressor) are provided.

Supported Frameworks

Target Notes
.NET 10 Full feature support
.NET 8 Full feature support
.NET Standard 2.1 Full feature support
.NET Standard 2.0 Requires System.Memory, IsExternalInit, IndexRange (auto-referenced)

License

MIT

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 126 5/25/2026