cert

package
v0.0.0-...-2ef905a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSerialNumber

func GenerateSerialNumber() (*big.Int, error)

GenerateSerialNumber creates a new serial number for a x509 certificate.

func New

func New(opts ...CertOption) ([]byte, []byte, error)

New generates a PEM encoded x509 cert and private key.

func NewCA

func NewCA(opts ...CertOption) ([]byte, []byte, error)

func NewClientFromCA

func NewClientFromCA(caPrivKeyPEM, caCertPEM io.Reader, opts ...CertOption) ([]byte, []byte, error)

func NewServerFromCA

func NewServerFromCA(caPrivKeyPEM, caCertPEM io.Reader, opts ...CertOption) ([]byte, []byte, error)

func ReadCertAndKey

func ReadCertAndKey(caCertPEM, caPrivKeyPEM io.Reader) (*x509.Certificate, interface{}, error)

func SaveCertAndKey

func SaveCertAndKey(prefix string, caCertPEM, caPrivKeyPEM []byte) error

Types

type CertOption

type CertOption func(*CertOptions) error

func IsCA

func IsCA() CertOption

func IsClient

func IsClient() CertOption

func IsServer

func IsServer() CertOption

func IsValidFor

func IsValidFor(d time.Duration) CertOption

func WithCommonName

func WithCommonName(name string) CertOption

func WithKey

func WithKey(key interface{}) CertOption

func WithNewECDSAKey

func WithNewECDSAKey() CertOption

func WithNewRSAKey

func WithNewRSAKey() CertOption

func WithParent

func WithParent(cert *x509.Certificate, key interface{}) CertOption

type CertOptions

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

Jump to

Keyboard shortcuts

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