certprovisioner

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package certprovisioner provides an interface and implementation to provision certificates.

Create a implementation instance of certprovisioner.

cp := SelfSignedCertProvisioner{
	// your configuration
}

Provision the certificates.

key, cert, caCert, err := cp.ProvisionServingCert()
if err != nil {
	// handle error
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertProvisioner

type CertProvisioner interface {
	// ProvisionServingCert returns the key, serving certificate and the CA certificate.
	ProvisionServingCert() (key []byte, cert []byte, caCert []byte, err error)
}

CertProvisioner is an interface to provision the serving certificate.

type SelfSignedCertProvisioner

type SelfSignedCertProvisioner struct {
	// Required DNS names for your certificate
	DNSNames []string
	// Organization name
	Organization string
	// Number of days the certificate will be valid for.
	ValidDays int
}

SelfSignedCertProvisioner implements the CertProvisioner interface. It provisions self-signed certificates.

Example
cp := SelfSignedCertProvisioner{
	Organization: "k8s.io",
	DNSNames:     []string{"myDNSName"},
	ValidDays:    365,
}

key, cert, caCert, err := cp.ProvisionServingCert()
if err != nil {
	// handle error
}
Output:

func (*SelfSignedCertProvisioner) ProvisionServingCert

func (cp *SelfSignedCertProvisioner) ProvisionServingCert() (key []byte, cert []byte, caCert []byte, err error)

ProvisionServingCert generates a CA and a serving cert. It returns the key, serving cert, CA cert and a potential error.

Jump to

Keyboard shortcuts

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