selfsignedcert

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Overview

Package selfsignedcert helps to create self-signed certificates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	// CertPEM is the certificate encoded using PEM.
	CertPEM []byte

	// KeyPEM is the secret key encoded using PEM.
	KeyPEM []byte
}

Cert is the self-signed certificate.

func New

func New(config *Config) *Cert

New generates a self-signed certificate and key with SANs.

This function panics on failure.

func (*Cert) WriteFiles

func (c *Cert) WriteFiles(baseDir string)

WriteFiles writes CertPEM to `cert.pem` and KeyPEM to `key.pem`.

This method panics on failure.

type Config

type Config struct {
	// CommonName is the certificate common name.
	CommonName string

	// DNSNames contains the alternative DNS names to include in the certificate.
	DNSNames []string

	// IPAddrs contains the IP addrs for which the certificate is valid.
	IPAddrs []net.IP
}

Config contains configuration for New.

func NewConfigExampleCom

func NewConfigExampleCom() *Config

NewConfigExampleCom creates a *Config for example.com using the www.example.com, 127.0.0.1, and ::1 sans.

Jump to

Keyboard shortcuts

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