certificates

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeCSRPEM

func EncodeCSRPEM(csr []byte) []byte

func EncodeCertPEM

func EncodeCertPEM(cert []byte) []byte

Helper functions to encode to PEM

func EncodeKeyPEM

func EncodeKeyPEM(key *rsa.PrivateKey) []byte

func GenerateCSR

func GenerateCSR(commonName string, keySize int) ([]byte, *rsa.PrivateKey, error)

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator handles certificate generation

func NewGenerator

func NewGenerator(options *Options) (*Generator, error)

NewGenerator creates a new certificate generator

func (*Generator) GenerateAll

func (g *Generator) GenerateAll() error

GenerateAll generates CA and all required certificates

func (*Generator) GenerateCA

func (g *Generator) GenerateCA() error

GenerateCA generates a new CA certificate and private key

func (*Generator) GenerateCert

func (g *Generator) GenerateCert(name string) error

GenerateCert generates a new certificate signed by the CA

func (*Generator) GetCAPEM

func (g *Generator) GetCAPEM() []byte

func (*Generator) SignCSR

func (g *Generator) SignCSR(csr []byte) ([]byte, error)

func (*Generator) ValidateExistingCerts

func (g *Generator) ValidateExistingCerts() error

type Options

type Options struct {
	// Organization name for the CA certificate
	Organization string
	// Common name for the CA certificate
	CommonName string
	// Valid duration for certificates
	ValidDays int
	// Key size in bits (e.g., 2048, 4096)
	KeySize int
	// Output directory for certificates
	OutputDir string
	// Hostnames to include in SAN
	Hostnames []string
	// IP addresses to include in SAN
	IPs []net.IP
}

Options represents configuration for certificate generation

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns default certificate generation options

Jump to

Keyboard shortcuts

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