Documentation
¶
Overview ¶
Package verify provides image checksum verification for streamed OS images.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Algorithm ¶
type Algorithm string
Algorithm represents a supported hash algorithm.
func ParseChecksum ¶
ParseChecksum parses a checksum string in the format "algo:hexhash". It validates that the hash is valid hex and the correct length for the algorithm.
func (Algorithm) DigestSize ¶
DigestSize returns the expected digest size in bytes for the algorithm.
type ChecksumReader ¶
type ChecksumReader struct {
// contains filtered or unexported fields
}
ChecksumReader wraps an io.Reader and computes a running checksum.
func NewChecksumReader ¶
func NewChecksumReader(r io.Reader, checksum string) (*ChecksumReader, error)
NewChecksumReader creates a reader that computes checksum while reading.
func (*ChecksumReader) Actual ¶
func (c *ChecksumReader) Actual() string
Actual returns the computed hex hash after reading.
func (*ChecksumReader) Read ¶
func (c *ChecksumReader) Read(p []byte) (int, error)
Read implements io.Reader.
func (*ChecksumReader) Verify ¶
func (c *ChecksumReader) Verify() error
Verify checks the computed checksum against expected. Must be called after all data has been read.
type VerifyConfig ¶
type VerifyConfig struct {
Checksum string `json:"checksum,omitempty"`
SignatureURL string `json:"signatureUrl,omitempty"`
PublicKeyPath string `json:"publicKeyPath,omitempty"`
}
VerifyConfig holds verification configuration.
func (*VerifyConfig) HasChecksum ¶
func (c *VerifyConfig) HasChecksum() bool
HasChecksum returns true if checksum verification is configured.
func (*VerifyConfig) HasSignature ¶
func (c *VerifyConfig) HasSignature() bool
HasSignature returns true if signature verification is configured.
func (*VerifyConfig) Validate ¶
func (c *VerifyConfig) Validate() error
Validate checks the verification config.