certs

package
v0.0.0-...-6410feb Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CACertAndKeyBaseName     = "ca"
	ServerCertBaseName       = "server"
	QemuServerCertCommonName = "qemu-server"
	ClientCertBaseName       = "client"
	QemuClientCertCommonName = "qemu-client"
)
View Source
const (
	CA_CERT_NAME     = "ca-cert.pem"
	CA_KEY_NAME      = "ca-key.pem"
	SERVER_CERT_NAME = "server-cert.pem"
	SERVER_KEY_NAME  = "server-key.pem"
	CLIENT_CERT_NAME = "client-cert.pem"
	CLIENT_KEY_NAME  = "client-key.pem"
)

Variables

View Source
var (
	QemuCertRootCA = QemuCert{
		Name:     "ca",
		LongName: "self-signed CA to provision identities for other qemu actions",
		BaseName: CACertAndKeyBaseName,
		// contains filtered or unexported fields
	}

	QemuCertServer = QemuCert{
		Name:     "server",
		LongName: "certificate for server",
		BaseName: ServerCertBaseName,
		CAName:   "ca",
		// contains filtered or unexported fields
	}

	QemuCertClient = QemuCert{
		Name:     "client",
		LongName: "certificate for the server to connect to client",
		BaseName: ClientCertBaseName,
		CAName:   "ca",
		// contains filtered or unexported fields
	}
)

Functions

func CreateByMap

func CreateByMap(dir string, input map[string]string) error

func FetchDefaultCerts

func FetchDefaultCerts(dir string) (map[string]string, error)

Types

type CertificateMap

type CertificateMap map[string]*QemuCert

CertificateMap is a flat map of certificates, keyed by Name.

func (CertificateMap) CertTree

func (m CertificateMap) CertTree() (CertificateTree, error)

CertTree returns a one-level-deep tree, mapping a CA cert to an array of certificates that should be signed by it.

type CertificateTree

type CertificateTree map[*QemuCert]Certificates

CertificateTree is represents a one-level-deep tree, mapping a CA to the certs that depend on it.

func (CertificateTree) CreateTree

func (t CertificateTree) CreateTree(dir string) error

CreateTree creates the CAs, certs signed by the CAs, and writes them all to disk.

type Certificates

type Certificates []*QemuCert

Certificates is a list of Certificates that should be created

func GetDefaultCertList

func GetDefaultCertList() Certificates

GetDefaultCertList returns all of the certificates qemu requires.

func (Certificates) AsMap

func (c Certificates) AsMap() CertificateMap

type QemuCert

type QemuCert struct {
	Name     string
	LongName string
	BaseName string
	CAName   string
	// contains filtered or unexported fields
}

QemuCert represents a cretificate that qemu required.

func (*QemuCert) CreateAsCA

func (k *QemuCert) CreateAsCA(dir string) (*x509.Certificate, crypto.Signer, error)

CreateAsCA creates a certificate authority, writing the files to disk and also returning the created CA so it can be used to sign child certs.

func (*QemuCert) CreateFromCA

func (k *QemuCert) CreateFromCA(dir string, caCert *x509.Certificate, caKey crypto.Signer) error

CreateFromCA makes and writes a certificate using the given CA cert and key.

func (*QemuCert) GetConfig

func (k *QemuCert) GetConfig() (*certutil.Config, error)

GetConfig returns the definition for the given cert.

Jump to

Keyboard shortcuts

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