Skip to content

Modify System.IO.Packaging files to ensure they are deterministic. Helpful for testing, build reproducibility, security verification, and ensuring package integrity across different build environments.

License

Notifications You must be signed in to change notification settings

SimonCropp/DeterministicIoPackaging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeterministicIoPackaging

Build status NuGet Status

Modify System.IO.Packaging files to ensure they are deterministic. Helpful for testing, build reproducibility, security verification, and ensuring package integrity across different build environments.

Example file formats that leverage System.IO.Packaging

  • .nupkg
  • Microsoft Office files

See Milestones for release notes.

NuGet

How it works

  • For an input package stream
  • Duplicate each entry with a consistent compression and consistent order
  • Omit package/services/metadata/core-properties/*.psmdcp entries
  • For the relationships entry _rels/.rels
    • Modify the Id of each Relationship to be deterministic
    • Remove the Relationship for the .psmdcp entry
    • Order Relationships by Type
  • For the relationships entry xl/_rels/workbook.xml.rels
    • Order Relationships by Type
  • For the relationships entry docProps/core.xml
    • Remove the creator, created, lastModifiedBy, and modified elements

Usage

Convert

using var sourceStream = File.OpenRead(packagePath);
await DeterministicPackage.ConvertAsync(sourceStream, targetStream);

snippet source | anchor

ConvertAsync

using var sourceStream = File.OpenRead(packagePath);
await DeterministicPackage.ConvertAsync(sourceStream, targetStream);

snippet source | anchor

Icon

Pi designed by Zaidan from The Noun Project.

About

Modify System.IO.Packaging files to ensure they are deterministic. Helpful for testing, build reproducibility, security verification, and ensuring package integrity across different build environments.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Languages