Help us shape the future of Go! Take the 2026 Go Developer Survey

physicalsig

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package physicalsig 读取由明文 OFD 入口定位的密文包签名,并隔离物理与逻辑引用域。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckContainer

func CheckContainer(ctx context.Context, pkg *container.Package, limits crypt.Limits) error

CheckContainer 在摘要读取前限制条目大小和总量,并拒绝歧义路径。

func LogicalPackage

func LogicalPackage(ctx context.Context, logical *container.Package, graph *Graph) (*container.Package, error)

LogicalPackage 从普通文档遍历中移除外层物理签名入口及其元数据。 原始字节仍在物理包上验证;外签 References 不能作为文档可达性的依据。 返回包借用 logical,不取得其所有权。

func ValidateXML

func ValidateXML(ctx context.Context, data []byte, root, docType string, target any) error

ValidateXML 检查受限 XML 及附录 B/基础 OFD 模式,避免重写时遗漏未知结构。

Types

type Graph

type Graph struct {
	Root           []byte
	Records        []Record
	Metadata       map[string]bool
	MetadataBytes  int64
	ProcessedBytes int64
	MetadataHashes map[string][32]byte
}

func Discover

func Discover(ctx context.Context, pkg *container.Package, limits crypt.Limits) (*Graph, error)

Discover 只从 OFD.xml 的签名列表发现签名。References 指向 Encryptions.xml 的普通签名按物理域解释,并必须同时保护 OFD.xml 和所属列表。 暂不支持同一包混合逻辑签名、Relative 或加密的签名入口;无物理签名返回 nil。

type Record

type Record struct {
	DocumentIndex   int
	ID, List, Value string
	Signature       models.Signature
}

type Verification

type Verification struct {
	Record Record
	Result *parser.SignatureVerificationResult
	Digest *parser.SignatureDigestResult
}

func Verify

func Verify(ctx context.Context, pkg *container.Package, graph *Graph, options *parser.SignatureVerificationOptions, limits crypt.Limits) ([]Verification, error)

Verify 明确使用原始物理包,不回退到解密后的同名路径。

Jump to

Keyboard shortcuts

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