Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CA ¶ added in v0.39.0
type CA struct {
// contains filtered or unexported fields
}
CA is a Certificate Authority.
func (*CA) GenerateAndSignNodeCert ¶ added in v0.39.0
func (ca *CA) GenerateAndSignNodeCert(input *NodeCSRInput) (*Certificate, error)
GenerateAndSignNodeCert generates and signs a node certificate, key and CSR based on the provided input and signs it with the CA.
func (*CA) GenerateCACert ¶ added in v0.39.0
func (ca *CA) GenerateCACert(input *CACSRInput) (*Certificate, error)
GenerateCACert generates a CA certificate, key and CSR based on the provided input.
func (*CA) SetCACert ¶ added in v0.39.0
func (ca *CA) SetCACert(cert *Certificate) error
SetCACert sets the CA certificate with the provided certificate and key.
type CACSRInput ¶ added in v0.37.0
type CACSRInput struct { CommonName string Country string Locality string Organization string OrganizationUnit string Expiry time.Duration KeySize int }
CACSRInput struct.
type Cert ¶ added in v0.39.0
type Cert struct { *CA CertStorage }
Cert is a wrapper struct for the Certificate Authority and the Certificate Storage.
type CertStorage ¶ added in v0.39.0
type CertStorage interface { LoadCaCert() (*Certificate, error) LoadNodeCert(nodeName string) (*Certificate, error) StoreCaCert(cert *Certificate) error StoreNodeCert(nodeName string, cert *Certificate) error }
CertStorage is an interface that wraps methods to load and store certificates.
type Certificate ¶ added in v0.37.0
Certificate stores the combination of Cert and Key along with the CSR if available.
func NewCertificateFromFile ¶ added in v0.37.0
func NewCertificateFromFile(certFilePath, keyFilePath, csrFilePath string) (*Certificate, error)
NewCertificateFromFile creates a new Certificate by loading cert, key and csr (if exists) from respecting files.
func (*Certificate) Write ¶ added in v0.37.0
func (c *Certificate) Write(certPath, keyPath, csrPath string) error
Write writes the cert, key and csr to disk.
type LocalDirCertStorage ¶ added in v0.37.0
type LocalDirCertStorage struct {
// contains filtered or unexported fields
}
LocalDirCertStorage is a certificate storage, that stores certificates in a local directory.
func NewLocalDirCertStorage ¶ added in v0.37.0
func NewLocalDirCertStorage(paths CaPaths) *LocalDirCertStorage
NewLocalDirCertStorage inits a new LocalDirCertStorage.
func (*LocalDirCertStorage) LoadCaCert ¶ added in v0.37.0
func (c *LocalDirCertStorage) LoadCaCert() (*Certificate, error)
LoadCaCert loads the CA certificate from disk.
func (*LocalDirCertStorage) LoadNodeCert ¶ added in v0.37.0
func (c *LocalDirCertStorage) LoadNodeCert(nodeName string) (*Certificate, error)
LoadNodeCert loads the node certificate from disk. Used to load CA certificate as well, as CA certificate can be seen as node named "ca".
func (*LocalDirCertStorage) StoreCaCert ¶ added in v0.37.0
func (c *LocalDirCertStorage) StoreCaCert(cert *Certificate) error
StoreCaCert stores the given CA certificate, its key and CSR on disk.
func (*LocalDirCertStorage) StoreNodeCert ¶ added in v0.37.0
func (c *LocalDirCertStorage) StoreNodeCert(nodeName string, cert *Certificate) error
StoreNodeCert stores the given certificate in a file in the baseFolder.