certformatter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputFieldSerialNumber = iota
	OutputFieldIssuer
	OutputFieldSubject
	OutputFieldValidity
	OutputFieldNotBefore
	OutputFieldNotAfter
	OutputFieldSKID
	OutputFieldAKID
	OutputFieldSANs
	OutputFieldRawCert
	OutputFieldSourceFile
	OutputFieldCertificateIndex
)
View Source
const (
	CertificateBlockType = "CERTIFICATE"
)
View Source
const FewCertificatesAllCertsAllField = `` /* 10374-byte string literal not displayed */
View Source
const FewCertificatesSomeCertsAllField = `` /* 4499-byte string literal not displayed */
View Source
const FewCertificatesSomeCertsSomeField = `` /* 685-byte string literal not displayed */

Variables

This section is empty.

Functions

func ToColonNotation

func ToColonNotation(hexNumber []byte) string

ToColonNotation adds colon to hex number. Example: F77DC5FDC4E89A1B7764A7F51DA0CCBF87609A6D -> F7:7D:C5:FD:C4:E8:9A:1B:77:64:A7:F5:1D:A0:CC:BF:87:60:9A:6D

Types

type Certificate

type Certificate struct {
	DecodedCertificate *x509.Certificate
	Source             string
}

func (Certificate) GetAKID

func (c Certificate) GetAKID() string

func (Certificate) GetIssuer

func (c Certificate) GetIssuer() string

func (Certificate) GetNotAfter

func (c Certificate) GetNotAfter() string

func (Certificate) GetNotBefore

func (c Certificate) GetNotBefore() string

func (Certificate) GetRawCert

func (c Certificate) GetRawCert() string

func (Certificate) GetSANs

func (c Certificate) GetSANs() string

func (Certificate) GetSKID

func (c Certificate) GetSKID() string

func (Certificate) GetSerialNumber

func (c Certificate) GetSerialNumber() string

func (Certificate) GetSubject

func (c Certificate) GetSubject() string

type Certstore

type Certstore struct {
	Certs map[int]Certificate
}

func NewCertstore

func NewCertstore() *Certstore

func (*Certstore) Load

func (c *Certstore) Load(rawCerts []byte, source string)

func (*Certstore) NewFormatter

func (c *Certstore) NewFormatter() *Formatter

type FormattedCertificate

type FormattedCertificate map[Outputfield]string

type Formatter

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

func (*Formatter) ComposeFormattedCertificates

func (f *Formatter) ComposeFormattedCertificates(formattedCertificates []FormattedCertificate, orderedFieldsToRender []Outputfield) (string, error)

func (*Formatter) GetFormattedCertificate

func (f *Formatter) GetFormattedCertificate(certIndex int) FormattedCertificate

GetFormattedCertificate returns a FormattedCertificate with the fields rendered using the functions defined in FieldsFormatFunctions.

func (*Formatter) SetComposeFunction

func (f *Formatter) SetComposeFunction(composeFunc func(certs []FormattedCertificate, orderedFieldsToRender []Outputfield) (string, error))

func (*Formatter) SetFieldFormatFunction

func (f *Formatter) SetFieldFormatFunction(field Outputfield, formatFunc func(c Certificate) string)

SetFieldFormatFunction substitutes the default format function for a field with the provided one.

type Outputfield

type Outputfield int

Jump to

Keyboard shortcuts

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