certificate

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 32 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockNotFound = errors.New("block not found")
View Source
var ErrNotValidCACertificate = errors.New("not valid ca certificate")
View Source
var JQFilterApplyCaSelfSignedCert = `{
    "key": .data."tls.key",
    "crt": .data."tls.crt"
}`

Functions

func GenerateCSR

func GenerateCSR(cn string, options ...Option) ([]byte, []byte, error)

func IsCertificateExpiringSoon

func IsCertificateExpiringSoon(cert []byte, durationLeft time.Duration) (bool, error)

func ParseCertificate

func ParseCertificate(crt []byte) (*x509.Certificate, error)

ParseCertificate parse x509 certificate PEM encoded

func ParseCertificatesFromBase64

func ParseCertificatesFromBase64(ca, crt, key string) (*x509.Certificate, *tls.Certificate, error)

ParseCertificatesFromBase64 parsing base64 input string and return ca cert and/or verified tls.Certificate

func ParseCertificatesFromPEM

func ParseCertificatesFromPEM(ca, crt, key []byte) (*x509.Certificate, *tls.Certificate, error)

ParseCertificatesFromPEM parsing PEM input strings and return ca cert and/or verified tls.Certificate

func Validator

func Validator(_ *csr.CertificateRequest) error

Validator does nothing and will never return an error. It exists because creating a csr.Generator requires a Validator.

func WaitForCertificate

func WaitForCertificate(ctx context.Context, clientWOWatch client.Client, reqName string, reqUID types.UID, logger pkg.Logger) ([]byte, error)

modified client-go@v0.29.8/util/certificate/csr/csr.go

WaitForCertificate waits for a certificate to be issued until timeout, or returns an error.

Types

type Authority

type Authority struct {
	Key  []byte `json:"key"`
	Cert []byte `json:"crt"`
}

func GenerateCA

func GenerateCA(cn string, options ...Option) (*Authority, error)

func GetOrCreateCa

func GetOrCreateCa(input *pkg.HookInput, snapshotKey, cn string) (*Authority, error)

type Certificate

type Certificate struct {
	Name string `json:"name,omitempty"`

	Key  []byte `json:"key"`
	Cert []byte `json:"crt"`
	CA   []byte `json:"ca"`
}

func GenerateSelfSignedCert

func GenerateSelfSignedCert(cn string, ca *Authority, options ...any) (*Certificate, error)

type Option

type Option func(request *csr.CertificateRequest)

func WithCAConfig

func WithCAConfig(caConfig *csr.CAConfig) Option

func WithCAExpiry

func WithCAExpiry(expiry time.Duration) Option

func WithCSRKeyRequest

func WithCSRKeyRequest(keyRequest *csr.KeyRequest) Option

WithCSRKeyRequest redeclare basic(ecdsa 2048) key alg and size

func WithGroups

func WithGroups(groups ...string) Option

func WithKeyAlgo

func WithKeyAlgo(algo string) Option

func WithKeyRequest

func WithKeyRequest(keyRequest *csr.KeyRequest) Option

func WithKeySize

func WithKeySize(size int) Option

func WithNames

func WithNames(names ...csr.Name) Option

func WithSANs

func WithSANs(sans ...string) Option

type SigningOption

type SigningOption func(signing *config.Signing)

func WithSigningDefaultExpiry

func WithSigningDefaultExpiry(expiry time.Duration) SigningOption

func WithSigningDefaultUsage

func WithSigningDefaultUsage(usage []string) SigningOption

Jump to

Keyboard shortcuts

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