caimport

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package caimport validates and persists an existing Nebula certificate authority without ever storing its plaintext signing key.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidMaterial      = errors.New("invalid CA material")
	ErrUnsupportedCurve     = errors.New("unsupported CA curve")
	ErrInvalidValidity      = errors.New("CA certificate is not currently valid")
	ErrKeyMismatch          = errors.New("CA private key does not match certificate")
	ErrDuplicateCA          = errors.New("CA already imported")
	ErrKDFLimits            = errors.New("private key KDF exceeds import limits")
	ErrDecryptBusy          = errors.New("another private key decrypt is in progress")
	ErrMasterKeyUnavailable = errors.New("master keystore not configured")
	ErrInputTooLarge        = errors.New("CA import input is too large")
)

Functions

This section is empty.

Types

type Importer

type Importer interface {
	Import(ctx context.Context, request Request) (*models.CA, error)
}

Importer is the shared CA import contract consumed by API and Web. A single Service instance should be shared by all server entrypoints so its Argon2 decrypt slot is process-wide.

type Limits

type Limits struct {
	MaxCertificateBytes  int
	MaxPrivateKeyBytes   int
	MaxArgon2MemoryKiB   uint32
	MaxArgon2Iterations  uint32
	MaxArgon2Parallelism uint8
}

Limits bounds uploaded material and the work accepted from an encrypted Nebula signing key. A zero-valued field is replaced with its safe default.

func DefaultLimits

func DefaultLimits() Limits

DefaultLimits returns the production CA import limits.

type Request

type Request struct {
	Name            string
	OwnerOperatorID string
	CertificatePEM  []byte
	PrivateKeyPEM   []byte
	Passphrase      []byte
}

Request contains one existing CA certificate and its signing key. Import consumes and zeroizes PrivateKeyPEM and Passphrase before returning.

type Service

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

Service implements the shared CA import path used by HTTP and CLI callers.

func NewService

func NewService(caStore caStore, master *keystore.Master, limits Limits) *Service

NewService creates a CA import service. Encrypted key decryption is globally serialized per service instance to bound Argon2 memory use.

func (*Service) Import

func (s *Service) Import(ctx context.Context, request Request) (*models.CA, error)

Import validates an existing Nebula CA, proves possession of its signing key, envelope-encrypts that key, and persists the resulting active CA.

Jump to

Keyboard shortcuts

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