DgReader 0.1.0-preview.14

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

DgReader

DgReader is a C# library for parsing and processing ICAO-compliant Data Groups found in electronic Machine Readable Travel Documents (eMRTDs) such as ePassports and ID cards.

NuGet

NuGet

Install via NuGet Package Manager: dotnet add package DgReader View on NuGet.org

This library supports parsing DG1, DG2, and DG11.

Features

  • ASN.1 Parsing: Handles TLV/ASN.1 encoded data groups.
  • Data Group Abstractions: Provides base and specialized classes for DG1 (TD1, TD2, Other), DG2 (Biometric Face Image), and DG11.
  • Data Extraction: Extracts structured data such as name, document number, nationality, date of birth, address, biometric face image, and more.
  • Error Handling: Safe parsing methods and tag verification.
  • Hash Calculation: SHA256 hashing for data integrity.

Example Usage

// Example: Parsing DG1 data group (TD1, TD2, or Other variant)
var dg1Bytes = ... // Load DG1 bytes from eMRTD
var dg1 = new DataGroup1(dg1Bytes);
if (dg1.Parse())
{
    var data = dg1.Values;
    Console.WriteLine($"Document Number: {data.DocumentNumber}");
    Console.WriteLine($"Name: {data.FirstName} {data.LastName}");
    Console.WriteLine($"MRZ Type: {data.MrzDocumentType}"); // TD1, TD2, or Other
}
 
// Example: Parsing DG11 data group
var dg11Bytes = ... // Load DG11 bytes from eMRTD
var dg11 = new DataGroup11(dg11Bytes);
if (dg11.Parse())
{
    var data = dg11.Values;
    Console.WriteLine($"Full Name: {data.FirstName} {data.LastName}");
    Console.WriteLine($"Address: {data.Address}");
}
 
// Example: Parsing DG2 data group (Biometric Face Image)
var dg2Bytes = ... // Load DG2 bytes from eMRTD
var dg2 = new DataGroup2(dg2Bytes);
if (dg2.Parse())
{
    var data = dg2.Values;
    Console.WriteLine($"Image Width: {data.ImageWidth}");
    Console.WriteLine($"Image Height: {data.ImageHeight}");
    Console.WriteLine($"Image Data Length: {data.ImageData?.Length}");
    // You can save or process the image data (JPEG/JPEG2000)
}

Supported Data Groups

  • DG1 (TD1, TD2, Other): MRZ (Machine Readable Zone) info: document type, number, names, nationality, date of birth, etc. Supports TD1, TD2, and Other MRZ formats.
  • DG2 (Biometric Face Image): Biometric facial image (JPEG/JPEG2000) and related metadata (image size, color space, quality, etc.).
  • DG11: Additional personal details: full name, address, place of birth, etc.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open issues or pull requests with improvements.

Authors

W4TR1X
batuhanoztrk

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 was computed.  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 was computed.  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 was computed. 
.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
0.1.0-preview.14 31 9/11/2026
0.1.0-preview.13 195 7/7/2025
0.1.0-preview.12 154 7/2/2025
0.1.0-preview.11 153 7/2/2025
0.1.0-preview.10 149 7/2/2025
0.1.0-preview.9 152 7/2/2025
0.1.0-preview.8 151 7/2/2025
0.1.0-preview.5 150 7/2/2025
0.1.0-preview.4 156 6/30/2025
0.1.0-preview.2 155 6/30/2025