certificate

package
v0.0.0-...-bff9524 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 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 CertificateReader

type CertificateReader interface {
	GetCertificate(ctx context.Context, serialNumber string) ([]byte, bool, time.Time, error)
	GetCACertificate(ctx context.Context) ([]byte, error)
}

type CertificateReaderWriter

type CertificateReaderWriter interface {
	CertificateReader
	CertificateWriter
}

type CertificateWriter

type CertificateWriter interface {
	GenerateCertificate(ctx context.Context, cn string, ttl time.Duration) ([]byte, []byte, []byte, error)
	SignCSR(ctx context.Context, csr []byte, cn string, ttl time.Duration) ([]byte, error)
}

type ConfigurationCacheReaderWriter

type ConfigurationCacheReaderWriter interface {
	Get(ctx context.Context, deviceID string) (entity.DeviceConfiguration, error)
	Put(ctx context.Context, deviceID string, conf entity.DeviceConfiguration) error
	Delete(ctx context.Context, deviceID string) error
}

type Service

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

func New

func New(certReaderWriter CertificateReaderWriter) *Service

func (*Service) GenerateRegistrationCertificate

func (m *Service) GenerateRegistrationCertificate(ctx context.Context, ttl time.Duration) (entity.CertificateGroup, error)

GenerateRegistrationCertificate returns a certificate used by the agent to registered itself.

func (*Service) GetCertificate

func (m *Service) GetCertificate(ctx context.Context, serialNumber string) (entity.CertificateGroup, error)

func (*Service) SignCSR

func (m *Service) SignCSR(ctx context.Context, csr []byte, cn string, ttl time.Duration) (entity.CertificateGroup, error)

func (*Service) TlsConfig

func (m *Service) TlsConfig(ctx context.Context, ttl time.Duration) (*tls.Config, error)

Jump to

Keyboard shortcuts

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