certificates

package
v0.0.0-...-330c09c Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 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

View Source
const (
	Organization      = "knative.dev"
	LegacyFakeDnsName = "data-plane." + Organization
	FakeDnsName       = LegacyFakeDnsName // Deprecated

	ControlPlaneName = "kn-control"

	//These keys are meant to line up with cert-manager, see
	//https://cert-manager.io/docs/usage/certificate/#additional-certificate-output-formats
	CaCertName     = "ca.crt"
	CertName       = "tls.crt"
	PrivateKeyName = "tls.key"

	//These should be able to be deprecated some time in the future when the new names are fully adopted
	SecretCaCertKey = "ca-cert.pem"
	SecretCertKey   = "public-cert.pem"
	SecretPKKey     = "private-key.pem"
)

Variables

This section is empty.

Functions

func DataPlaneRoutingName

func DataPlaneRoutingName(routingId string) string

DataPlaneRoutingName constructs a san for a data-plane-routing certificate Accepts a routingId - a unique identifier used as part of the san (default is "0" used when an empty routingId is provided)

func DataPlaneUserName

func DataPlaneUserName(namespace string) string

DataPlaneUserName constructs a san for a data-plane-user certificate Accepts a namespace - the namespace for which the certificate was created

func ParseCert

func ParseCert(certPemBytes []byte, privateKeyPemBytes []byte) (*x509.Certificate, *rsa.PrivateKey, error)

ParseCert parses a certificate/private key pair from serialized pem blocks

func ValidateCert

func ValidateCert(cert *x509.Certificate, rotationThreshold time.Duration) error

ValidateCert checks the expiration of the certificate

Types

type KeyPair

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

func CreateCACerts

func CreateCACerts(ctx context.Context, expirationInterval time.Duration) (*KeyPair, error)

CreateCACerts generates the root CA cert

func CreateCert

func CreateCert(ctx context.Context, caKey *rsa.PrivateKey, caCertificate *x509.Certificate, expirationInterval time.Duration, sans ...string) (*KeyPair, error)

CreateCert generates the certificate for use by client and server

func CreateControlPlaneCert deprecated

func CreateControlPlaneCert(ctx context.Context, caKey *rsa.PrivateKey, caCertificate *x509.Certificate, expirationInterval time.Duration) (*KeyPair, error)

Deprecated: CreateControlPlaneCert generates the certificate for the client

func CreateDataPlaneCert deprecated

func CreateDataPlaneCert(ctx context.Context, caKey *rsa.PrivateKey, caCertificate *x509.Certificate, expirationInterval time.Duration) (*KeyPair, error)

Deprecated: CreateDataPlaneCert generates the certificate for the server

func NewKeyPair

func NewKeyPair(privateKey *pem.Block, cert *pem.Block) *KeyPair

func (*KeyPair) Cert

func (kh *KeyPair) Cert() *pem.Block

func (*KeyPair) CertBytes

func (kh *KeyPair) CertBytes() []byte

func (*KeyPair) Parse

func (kh *KeyPair) Parse() (*x509.Certificate, *rsa.PrivateKey, error)

func (*KeyPair) PrivateKey

func (kh *KeyPair) PrivateKey() *pem.Block

func (*KeyPair) PrivateKeyBytes

func (kh *KeyPair) PrivateKeyBytes() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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