validate

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExpectedVersion = "1"

Functions

func IsConfigValid

func IsConfigValid(config *Config) bool

Types

type CertificateEntry

type CertificateEntry struct {
	Fingerprints CertificateFingerprints `json:"fingerprints"`
	Comment      string                  `json:"comment,omitempty"`
}

type CertificateFingerprints

type CertificateFingerprints struct {
	Sha1   string `json:"sha1,omitempty"`
	Sha256 string `json:"sha256,omitempty"`
}

type Config

type Config struct {
	Version string             `json:"version"`
	Allow   []CertificateEntry `json:"allow,omitempty"`
	Forbid  []CertificateEntry `json:"forbid,omitempty"`
	Require []CertificateEntry `json:"require,omitempty"`
}

func LoadConfig

func LoadConfig(fileName string) (*Config, error)

type ForbiddenCert

type ForbiddenCert struct {
	Certificate certificate.Found
	Entry       CertificateEntry
}

type Result

type Result struct {
	NotAllowedCertificates []certificate.Found
	ForbiddenCertificates  []ForbiddenCert
	RequiredButAbsent      []CertificateEntry
}

func (*Result) IsPass

func (r *Result) IsPass() bool

type Validator

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

func NewValidator

func NewValidator(config Config, permissiveMode bool) (*Validator, error)

func (*Validator) DescribeConfig

func (v *Validator) DescribeConfig() string

func (*Validator) IsAllowed

func (v *Validator) IsAllowed(result certificate.Found) bool

func (*Validator) IsForbidden

func (v *Validator) IsForbidden(result certificate.Found) (bool, *CertificateEntry)

func (*Validator) Validate

func (v *Validator) Validate(founds []certificate.Found) (Result, error)

Jump to

Keyboard shortcuts

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