tls

package
v3.12.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 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

Overview

Package gencert generates a certificate authority (CA) and a server certificate signed by it.

Index

Constants

View Source
const (
	CaOrganization      = "F5 Inc. CA"
	CertOrganization    = "F5 Inc."
	CertFilePermissions = 0o600
	KeyFilePermissions  = 0o600
)

Predefined constants for Org and file permissions

Variables

This section is empty.

Functions

func DoesCertAlreadyExist

func DoesCertAlreadyExist(certPath string) (bool, error)

Returns true if a valid certificate is found at certPath

func GenerateCA

func GenerateCA(now time.Time, caCertPath string) (*x509.Certificate, *ecdsa.PrivateKey, error)

Generates a CA, returns x509 Certificate and private key for signing server certificates

func GenerateCertificate

func GenerateCertificate(req *CertReq) (*x509.Certificate, []byte, error)

Returns x509 Certificate object and bytes in PEM format

func GenerateServerCerts

func GenerateServerCerts(hostnames []string, caPath, certPath, keyPath string) (existingCert bool, err error)

GenerateServerCerts creates a server CA, Cert and Key and writes them to specified destinations. Hostnames are a list of subject alternative names. If cert files are already present, does nothing, returns true.

Types

type CertReq

type CertReq struct {
	Template   *x509.Certificate
	Parent     *x509.Certificate
	PublicKey  *ecdsa.PublicKey
	PrivateKey *ecdsa.PrivateKey
}

CertReq contains a ECDSA key pair and 2 x509.Certificate templates, a server and parent. When generating a CA, template and parent are identical, making the CA "self-signed". When generating a server certificate, the `parent` is the CA template and `template` is the server.

Jump to

Keyboard shortcuts

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