package verify

import "github.com/google/go-containerregistry/internal/verify"

Package verify provides a ReadCloser that verifies content matches the expected hash values.

Index

Constants

const SizeUnknown = -1

SizeUnknown is a sentinel value to indicate that the expected size is not known.

Functions

func Descriptor

func Descriptor(d v1.Descriptor) error

Descriptor verifies that the embedded Data field matches the Size and Digest fields of the given v1.Descriptor, returning an error if the Data field is missing or if it contains incorrect data.

func ReadCloser

func ReadCloser(r io.ReadCloser, size int64, h v1.Hash) (io.ReadCloser, error)

ReadCloser wraps the given io.ReadCloser to verify that its contents match the provided v1.Hash before io.EOF is returned.

The reader will only be read up to size bytes, to prevent resource exhaustion. If EOF is returned before size bytes are read, an error is returned.

A size of SizeUnknown (-1) indicates disables size verification when the size is unknown ahead of time.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error provides information about the failed hash verification.

func (Error) Error

func (v Error) Error() string

Source Files

verify.go

Version
v0.20.3 (latest)
Published
Jan 15, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
21 hours ago

Tools for package owners.