package zcert
import "zgo.at/zcert"
Index ¶
- type CARoot
- func New() (ca CARoot, created bool, err error)
- func (ca CARoot) Certificate() *x509.Certificate
- func (ca *CARoot) Create() error
- func (ca CARoot) Delete() error
- func (ca CARoot) Exists() bool
- func (ca CARoot) Install() error
- func (ca *CARoot) Load() error
- func (ca CARoot) MakeCert(out io.Writer, clientCert bool, hosts ...string) error
- func (ca CARoot) MakeTLSCert(clientCert bool, hosts ...string) (*tls.Certificate, error)
- func (CARoot) StorePath() (string, string)
- func (ca CARoot) TLSConfig() *tls.Config
- func (ca CARoot) Uninstall() error
- type Group
Types ¶
type CARoot ¶
type CARoot struct { Verbose bool // Print verbose output to stderr. // contains filtered or unexported fields }
CARoot is a root certificate that's used to sign certificates with.
func New ¶
New creates a new instance of CARoot. It will load an existing root certificate if it exists, or creates a new one if it doesn't.
func (CARoot) Certificate ¶
func (ca CARoot) Certificate() *x509.Certificate
Certificate gets the loaded root certificate; may return nil if Load() isn't called yet.
func (*CARoot) Create ¶
Create a new root certificate; this will return an error if a root CA already exist.
func (CARoot) Delete ¶
Delete the root certificate.
func (CARoot) Exists ¶
Exists reports if the root certificate exits.
func (CARoot) Install ¶
Install the root certificate to all truststores we can find.
func (*CARoot) Load ¶
Load the root certificate from disk.
func (CARoot) MakeCert ¶
MakeCert creates a new certificate signed with the root certificate and writes the PEM-encoded data to out.
func (CARoot) MakeTLSCert ¶
MakeTLS creates a new TLS certificate signed with the root certificate.
func (CARoot) StorePath ¶
StorePaths gets the full path name to the root certificate. Returns certificate and key.
func (CARoot) TLSConfig ¶
TLSConfig returns a new tls.Config which creates certificates for any hostname.
func (CARoot) Uninstall ¶
Uninstall the root certificate from all truststores we can find.
type Group ¶
type Group struct { // Maximum number of errors; calls to Append() won't do anything if the number of errors is larger than this. MaxSize int // contains filtered or unexported fields }
Group multiple errors.
func NewGroup ¶
NewGroup create a new Group instance. It will record a maximum of maxSize errors. Set to 0 for no limit.
func (*Group) Append ¶
Append a new error to the list; this is thread-safe.
It won't do anything if the error is nil, in which case it will return false. This makes appending errors in a loop slightly nicer:
for { err := do() if errors.Append(err) { continue } }
func (Group) Error ¶
func (*Group) ErrorOrNil ¶
ErrorOrNil returns itself if there are errors, or nil otherwise.
It avoids an if-check at the end:
return errs.ErrorOrNil()
func (Group) Len ¶
Len returns the number of errors.
Source Files ¶
errors.go zcert.go
Directories ¶
Path | Synopsis |
---|---|
cmd | |
cmd/serve | |
cmd/zcert | |
truststore |
- Version
- v0.0.0-20211017212315-ace8b819ce86 (latest)
- Published
- Oct 17, 2021
- Platform
- linux/amd64
- Imports
- 27 packages
- Last checked
- 1 week ago –
Tools for package owners.