Documentation ¶
Overview ¶
Package mkcert provides the private CA for mTLS
Index ¶
Constants ¶
View Source
const ( // DefaultKeyFilePermissions are the permissions used when creating the KeyFile DefaultKeyFilePermissions os.FileMode = 0600 // DefaultCertFilePermissions are the permissions used when creating the CertFile DefaultCertFilePermissions os.FileMode = 0644 // DefaultDirPermissions are the permissions used when creating the RootDir DefaultDirPermissions os.FileMode = 0700 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CA ¶
type CA struct {
// contains filtered or unexported fields
}
CA is a private PKI for mTLS
func (*CA) GetCertificate ¶
func (m *CA) GetCertificate(chi *tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns the TLS Certificate that should be used for a given TLS request
func (*CA) WriteCertFile ¶
WriteCertFile writes the CA's Certificate PEM encoded, using the filename in the [Config.CertFile]
func (*CA) WriteKeyFile ¶
WriteKeyFile writes the CA's Private Key PEM encoded, using the filename in the [Config.KeyFile]
type Config ¶
type Config struct { // RootDir is the directory where key and cert are securely stored RootDir string `toml:"caroot_dir" default:"~/.local/share/mkcert"` // KeyFile is the filename of the CA key within the RootDir KeyFile string `toml:"key_file" default:"rootCA-key.pem"` // CertFile is the filename of the CA certificate within the RootDir CertFile string `toml:"cert_file" default:"rootCA.pem"` // Certificates include infomation for the issued certificates Certificates ca.TemplateConfig `toml:"certificates,omitempty"` // Issuer include infomation for creating the CA Issuer ca.TemplateConfig `toml:"issuer,omitempty"` // KeyAlgorithm indicates the KeyAlgorigthm to be used. // RSA, ECDSA, or ED25519. case-insensitive. KeyAlgorithm string `toml:"algorithm,omitempty"` }
Config is the configuration of a CA
func (*Config) CertFileName ¶
CertFileName returns the full path to the [Config.CertFile]
func (*Config) KeyFileName ¶
KeyFileName returns the full path to the [Config.KeyFile]
func (*Config) SetDefaults ¶
SetDefaults fills the gaps in the Config
Click to show internal directories.
Click to hide internal directories.