prsr

package
v0.0.0-...-daf41ac Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainLoadedError

type ChainLoadedError struct {
	Err error
}

ChainLoadedError This error is thrown when the whole chain is loaded and we don't need to iterate through the links anymore

func (*ChainLoadedError) Error

func (e *ChainLoadedError) Error() string

type Loader

type Loader interface {
	LoadCert(id string, idType utils.IdType) ([]byte, error)
	LoadIntermediateCerts(c *crt.Certificate) ([][]byte, bool, error)
	LoadRootCerts() ([][]byte, error)
}

type Organization

type Organization struct {
	Country            string `json:"country,omitempty"`
	Organization       string `json:"organization,omitempty"`
	OrganizationalUnit string `json:"organizational_unit,omitempty"`
	Locality           string `json:"locality,omitempty"`
	Province           string `json:"province,omitempty"`
	StreetAddress      string `json:"street_address,omitempty"`
	PostalCode         string `json:"postal_code,omitempty"`
	SerialNumber       string `json:"serial_number,omitempty"`
	CommonName         string `json:"common_name,omitempty"`
	Unit               string `json:"unit,omitempty"`
}

type ParsedAndValidatedCertificate

type ParsedAndValidatedCertificate struct {
	ParsedCertificate
	IsTrusted bool `json:"is_trusted"`
	IsRevoked bool `json:"is_revoked"`
	IsValid   bool `json:"is_valid"`
}

type ParsedCertificate

type ParsedCertificate struct {
	Sha256       string                       `json:"sha256"`
	Issuer       Organization                 `json:"issuer"`
	Subject      Organization                 `json:"subject"`
	NotBefore    time.Time                    `json:"not_before"`
	NotAfter     time.Time                    `json:"not_after"`
	SerialNumber *big.Int                     `json:"serial_number"`
	KeyUsage     []string                     `json:"key_usage"`
	ExtKeyUsage  []string                     `json:"ext_key_usage"`
	ParentLinks  []string                     `json:"parent_links"`
	CrlLinks     []string                     `json:"crl_link"`
	Plugins      map[string]PluginParseResult `json:"plugins"`
}

type Parser

type Parser struct {
	Plugins map[string]Plugin
	Loader  Loader
	Saver   Saver
}

func NewParser

func NewParser(plugins map[string]Plugin, loader Loader, saver Saver) *Parser

func (*Parser) GetChain

func (p *Parser) GetChain(certificates [][]byte) (*x509.CertPool, error)

func (*Parser) IsRevoked

func (p *Parser) IsRevoked(c *crt.Certificate) (bool, error)

func (*Parser) IsTrusted

func (p *Parser) IsTrusted(c *crt.Certificate) (bool, error)

func (*Parser) LoadCertFromBytes

func (p *Parser) LoadCertFromBytes(content []byte, uri string) ([]*crt.Certificate, error)

func (*Parser) LoadParentCertificates

func (p *Parser) LoadParentCertificates(c *crt.Certificate) ([]*crt.Certificate, error)

func (*Parser) LoadRootChain

func (p *Parser) LoadRootChain(c *crt.Certificate) (*x509.CertPool, error)

func (*Parser) Parse

func (p *Parser) Parse(crt *crt.Certificate) (ParsedCertificate, error)

func (*Parser) ParseAndValidate

func (p *Parser) ParseAndValidate(crt *crt.Certificate) (ParsedAndValidatedCertificate, error)

func (*Parser) ParseOrganization

func (p *Parser) ParseOrganization(org pkix.Name) Organization

type Plugin

type Plugin interface {
	Parse(c *crt.Certificate) PluginParseResult
}

type PluginParseResult

type PluginParseResult interface {
}

type Saver

type Saver interface {
	SaveIntermediateCerts(c *crt.Certificate, certs [][]byte) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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