cabfile

package
v6.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Magic = 0x4643534d // MSCF

Variables

This section is empty.

Functions

This section is empty.

Types

type Cabinet

type Cabinet struct {
	Header          Header
	ReserveHeader   ReserveHeader
	ReserveData     []byte
	SignatureHeader *SignatureHeader
	Signature       []byte
}

func Parse

func Parse(r io.Reader) (*Cabinet, error)

Parse the cabinet file header and return it

type CabinetDigest

type CabinetDigest struct {
	Cabinet  *Cabinet
	Imprint  []byte
	HashFunc crypto.Hash
	Patched  []byte
}

func Digest

func Digest(r io.Reader, hashFunc crypto.Hash) (*CabinetDigest, error)

Calculate the digest (imprint) of a CAB file for signing purposes

func (*CabinetDigest) MakePatch

func (d *CabinetDigest) MakePatch(pkcs []byte) *binpatch.PatchSet

Create a patchset that will apply the given signature blob to a previously digested cabinet file, replacing any existing signature

type CabinetFlag

type CabinetFlag uint16
const (
	FlagPrevCabinet CabinetFlag = 1 << iota
	FlagNextCabinet
	FlagReservePresent
)

type FolderHeader

type FolderHeader struct {
	Offset      uint32
	NumData     uint16
	Compression uint16
}
type Header struct {
	Magic       uint32
	Reserved1   uint32
	TotalSize   uint32
	Reserved2   uint32
	OffsetFiles uint32
	Reserved3   uint32
	Version     uint16
	NumFolders  uint16
	NumFiles    uint16
	Flags       CabinetFlag
	SetID       uint16
	CabNumber   uint16
}

type ReserveHeader

type ReserveHeader struct {
	HeaderSize uint16
	FolderSize uint8
	DataSize   uint8
}

type SignatureHeader

type SignatureHeader struct {
	Unknown1           uint32
	CabinetSize        uint32
	SignatureSize      uint32
	Unknown2, Unknown3 uint32
}

func (*SignatureHeader) Size

func (sh *SignatureHeader) Size() uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL