certificate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	Domains       []string `json:"domains"`
	CertUrl       *string  `json:"certUrl"`
	CertStableUrl *string  `json:"certStableUrl"`

	CreatedAt time.Time `json:"createdAt"`
	NotAfter  time.Time `json:"notAfter"`
	Pem       []byte    `json:"pem"`

	KeyCreatedAt time.Time              `json:"privateKeyCreatedAt"`
	Key          *privatekey.PrivateKey `json:"privateKey"`
}

func New

func New(domains []string) *Certificate

func (*Certificate) Add

func (c *Certificate) Add(data [][]byte) error

func (*Certificate) Request

func (c *Certificate) Request() ([]byte, error)

certRequest generates a CSR for the given common name cn and optional SANs. see: https://github.com/golang/crypto/blob/5c72a883971a4325f8c62bf07b6d38c20ea47a6a/acme/autocert/autocert.go#L1137

func (*Certificate) ValidCert

func (c *Certificate) ValidCert(der [][]byte, now time.Time) (leaf *x509.Certificate, err error)

validCert parses a cert chain provided as der argument and verifies the leaf and der[0] correspond to the private key, the domain and key type match, and expiration dates are valid. It doesn't do any revocation checking.

The returned value is the verified leaf cert. see: https://github.com/golang/crypto/blob/5c72a883971a4325f8c62bf07b6d38c20ea47a6a/acme/autocert/autocert.go#L1177

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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