ca

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxTLSDays = 825
)

Variables

This section is empty.

Functions

func ParseDomains

func ParseDomains(domainStr []string) ([]string, error)

func ParseIPs

func ParseIPs(ipStr []string) ([]net.IP, error)

Types

type CA

type CA interface {
	CreateKey() error
	CreateCert() error
	Write(keyPath, certPath, chainPath string) error
}

type RootCA

type RootCA struct {
	Key     *rsa.PrivateKey
	Cert    *x509.Certificate
	KeyBits int // 1024 * 2^x
}

func LoadRootCA

func LoadRootCA(keyPath, certPath, password string) (*RootCA, error)

LoadRootCA create new tls CA

func NewRootCA

func NewRootCA(keyBits int) (*RootCA, error)

NewRootCA create new root CA

func (*RootCA) CreateCert

func (c *RootCA) CreateCert() error

CreateCert create root cert

func (*RootCA) CreateKey

func (c *RootCA) CreateKey() error

CreateKey create root key

func (*RootCA) Write

func (c *RootCA) Write(rootCAKeyPath, rootCACertPath, chainPath string) error

Write root key/cert to file

type TLSCA

type TLSCA struct {
	Key     *rsa.PrivateKey
	Cert    *x509.Certificate
	KeyBits int // 1024 * 2^x

	RootCert *x509.Certificate
	RootKey  *rsa.PrivateKey
}

func LoadTLSCA

func LoadTLSCA(keyPath, certPath, password string) (*TLSCA, error)

LoadTLSCA create new tls CA

func NewTLSCA

func NewTLSCA(keyBits int, rootCert *x509.Certificate, rootKey *rsa.PrivateKey) (*TLSCA, error)

NewTLSCA create new tls CA

func (*TLSCA) CreateCert

func (c *TLSCA) CreateCert() error

CreateCert create tls cert

func (*TLSCA) CreateKey

func (c *TLSCA) CreateKey() error

CreateKey create tls key

func (*TLSCA) Sign

func (c *TLSCA) Sign(commonName string, domains []string, ips []net.IP, days, keyBits int) (*rsa.PrivateKey, *x509.Certificate, error)

func (*TLSCA) Write

func (c *TLSCA) Write(keyPath, certPath, chainPath string) error

Write root key/cert to file

func (*TLSCA) WriteCert

func (c *TLSCA) WriteCert(commonName string, key *rsa.PrivateKey, cert *x509.Certificate, tlsChainPath string) error

Jump to

Keyboard shortcuts

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