Version: v1.0.9 Latest Latest

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 17 Imported by: 0




This section is empty.


This section is empty.


func EncodeCertPEM

func EncodeCertPEM(cert *x509.Certificate) []byte

EncodeCertPEM returns PEM-endcoded certificate data

func GenerateBootstrapToken

func GenerateBootstrapToken() (id string, secret string)

GenerateBootstrapToken constructs a bootstrap token in conformance with the following format:

func GenerateCertHash

func GenerateCertHash(data []byte) ([]byte, error)

func GenerateCertHashFromFile

func GenerateCertHashFromFile(caCertPath string) ([]byte, error)

func MustEncodePrivateKeyPem

func MustEncodePrivateKeyPem(key crypto.Signer) []byte

func NewPrivateKey

func NewPrivateKey() (crypto.Signer, error)

func NewSelfSignedCACert

func NewSelfSignedCACert(cfg *Config, key crypto.Signer) (*x509.Certificate, error)

NewSelfSignedCACert creates a CA certificate

func NewSignedCert

func NewSignedCert(cfg *Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error)

NewSignedCert creates a signed certificate using the given CA certificate and key

func ReadCertFromFile

func ReadCertFromFile(path string) (*x509.Certificate, error)

func ReadKeyFromFile

func ReadKeyFromFile(path string) (crypto.Signer, error)

func WriteCert

func WriteCert(path, name string, cert *x509.Certificate) error

func WriteCertAndKey

func WriteCertAndKey(path, name string, cert *x509.Certificate, key crypto.Signer) error

func WriteKey

func WriteKey(path, name string, key crypto.Signer) error

func WritePublicKey

func WritePublicKey(path, name string, key crypto.PublicKey) error


type AltNames

type AltNames struct {
	DNSNames []string
	IPs      []net.IP

AltNames contains the domain names and IP addresses that will be added to the API Server's x509 certificate SubAltNames field. The values will be passed directly to the x509.Certificate object.

type CertificateAuthority

type CertificateAuthority struct {

func LoadCertificateAuthority

func LoadCertificateAuthority(path, name string) (*CertificateAuthority, error)

func NewCertificateAuthority

func NewCertificateAuthority(name string, cfg *Config) (*CertificateAuthority, error)

func (*CertificateAuthority) NewSignedKeyPair

func (c *CertificateAuthority) NewSignedKeyPair(name string, cfg *Config) (*KeyPair, error)

NewSignedKeyPair returns a new KeyPair signed by the CA.

type Config

type Config struct {
	CommonName   string
	Organization []string
	AltNames     AltNames
	Usages       []x509.ExtKeyUsage

Config contains the basic fields required for creating a certificate

type KeyPair

type KeyPair struct {
	Name string
	Cert *x509.Certificate
	Key  crypto.Signer

func LoadKeyPair

func LoadKeyPair(path, name string) (*KeyPair, error)

func (*KeyPair) WriteFiles

func (k *KeyPair) WriteFiles(dir string) error

Jump to

Keyboard shortcuts

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