certificate

package
v1.24.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DurationYear = time.Hour * 24 * 365
)

Variables

This section is empty.

Functions

func EncodeToX509Pair added in v1.23.8

func EncodeToX509Pair(in tls.Certificate) ([]byte, []byte)

func IssueCertificate added in v1.23.8

func IssueCertificate(caPEMBlock, certPEMBlock, keyPEMBlock []byte, options CertOptions) ([]byte, []byte, error)

nolint: gomnd,funlen IssueCertificate issues a certificate with the given CA certificate and key.

Types

type CertOptions added in v1.23.8

type CertOptions struct {
	CommonName string
	Hosts      []string
	ExpireAt   *time.Time
}

type Certificate

type Certificate struct {
	Subject            Name      `json:"subject,omitempty"`
	Issuer             Name      `json:"issuer,omitempty"`
	SerialNumber       string    `json:"serial_number,omitempty"`
	SANs               []string  `json:"sans,omitempty"`
	NotBefore          time.Time `json:"not_before"`
	NotAfter           time.Time `json:"not_after"`
	SignatureAlgorithm string    `json:"sigalg"`
	AKI                string    `json:"authority_key_id"`
	SKI                string    `json:"subject_key_id"`
	RawPEM             string    `json:"pem"`
}

nolint: tagliatelle

func ParseCertInfo

func ParseCertInfo(certPEM []byte) (*Certificate, error)

type Name

type Name struct {
	CommonName         string                       `json:"common_name,omitempty"`
	SerialNumber       string                       `json:"serial_number,omitempty"`
	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"`
	Names              []pkix.AttributeTypeAndValue `json:"names,omitempty"`
	ExtraNames         []pkix.AttributeTypeAndValue `json:"extra_names,omitempty"`
}

nolint: tagliatelle

func ParseName

func ParseName(name pkix.Name) Name

Jump to

Keyboard shortcuts

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