certificates

package
v0.0.0-...-4ab1284 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootCACert             = "certs" + string(os.PathSeparator) + "root.crt"
	RootCAKey              = "certs" + string(os.PathSeparator) + "root.key"
	ClientCertificatesPath = "certs" + string(os.PathSeparator) + "client"
	ServerCertificatesPath = "certs" + string(os.PathSeparator) + "server"
	PrivateKeyBits         = 2048
	CertYears              = 10
)

Variables

View Source
var (
	ErrFailedToParseCSRPEM      = errors.New("failed to parse CSR PEM")
	ErrFailedToParseRootCertPEM = errors.New("failed to parse root certificate PEM")
	ErrFailedToParseRootKeyPEM  = errors.New("failed to parse root key PEM")
)

Functions

func DecodePossibleBase64

func DecodePossibleBase64(input string) []byte

func IsPEMContent

func IsPEMContent(data []byte) bool

Types

type Service

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

func NewService

func NewService(fileManager files.FileManager) *Service

func (*Service) Fingerprint

func (s *Service) Fingerprint(certPEM string) (string, error)

func (*Service) Generate

func (s *Service) Generate(
	ctx context.Context,
	certificatePath, keyPath string,
	opts *SignOptions,
) (string, string, error)

Generate generates a new certificate signed with the root certificate. Returns the certificate PEM and private key PEM.

func (*Service) Root

func (s *Service) Root(ctx context.Context) (string, error)

Root returns the root certificate.

func (*Service) RootKey

func (s *Service) RootKey(ctx context.Context) (string, error)

RootKey returns the root private key.

func (*Service) Sign

func (s *Service) Sign(ctx context.Context, csrPEM string, opts *SignOptions) (string, error)

type SignOptions

type SignOptions struct {
	CommonName         string
	Email              string
	Organization       string
	Country            string
	State              string
	Locality           string
	OrganizationalUnit string
}

Jump to

Keyboard shortcuts

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