certificate

package
v3.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertToPEMFormat added in v3.4.0

func CertToPEMFormat(tlsCert tls.Certificate) (cert []byte, key []byte)

CertToPEMFormat converts a tls.Certificate to PEM format.

func GetKongSystemSelfSignedCerts

func GetKongSystemSelfSignedCerts() (cert []byte, key []byte)

GetKongSystemSelfSignedCerts returns the self-signed certificate and key with CN=*.<controllerNamespace>.svc and subjectAltName=DNS:*.<controllerNamespace>.svc.

func MustGenerateCert added in v3.4.0

func MustGenerateCert(opts ...SelfSignedCertificateOption) tls.Certificate

MustGenerateCert generates a tls.Certificate struct to be used in TLS client/listener configurations. If no parent certificate is passed using WithParent option, the certificate is self-signed thus returned cert can be used as CA for it.

func MustGenerateCertPEMFormat added in v3.4.0

func MustGenerateCertPEMFormat(opts ...SelfSignedCertificateOption) (cert []byte, key []byte)

MustGenerateCertPEMFormat generates a certificate and returns certificate and key in PEM format. If no parent certificate is passed using WithParent option, the certificate is self-signed thus returned cert can be used as CA for it.

Types

type SelfSignedCertificateOption added in v3.2.0

type SelfSignedCertificateOption func(certificateOptions) certificateOptions

func WithAlreadyExpired

func WithAlreadyExpired() SelfSignedCertificateOption

WithAlreadyExpired allows to generate an already expired certificate.

func WithCATrue

func WithCATrue() SelfSignedCertificateOption

WithCATrue allows to use returned certificate to sign other certificates (uses BasicConstraints extension).

func WithCommonName

func WithCommonName(commonName string) SelfSignedCertificateOption

func WithDNSNames

func WithDNSNames(dnsNames ...string) SelfSignedCertificateOption

func WithMaxPathLen added in v3.4.0

func WithMaxPathLen(maxLen int) SelfSignedCertificateOption

WithMaxPathLen sets the MaxPathLen constraint in the certificate.

func WithParent added in v3.4.0

func WithParent(parent tls.Certificate) SelfSignedCertificateOption

WithParent allows to sign the certificate with a parent certificate.

Jump to

Keyboard shortcuts

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