backupseal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package backupseal encrypts the backups of the key store with age (filippo.io/age), for the public key of the owner (#75): the process that seals a backup cannot open it. It also opens a dump sealed for a key drawn for one restore in production (#297).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSigningKey means the signing key is not 32 bytes of hex, the seed
	// of an Ed25519 private key.
	ErrSigningKey = errors.New("backup signing key must be 32 bytes of hex")

	// ErrVerifyKey means the verify key is not 32 bytes of hex, an Ed25519
	// public key.
	ErrVerifyKey = errors.New("restore verify key must be 32 bytes of hex")

	// ErrSignature means the dump carries no signature, or one the verify
	// key does not accept: it was not made by the backup job.
	ErrSignature = errors.New("dump signature missing or invalid")
)
View Source
var ErrIdentity = errors.New("restore identity must be one age private key")

ErrIdentity means the identity is not one native age private key.

View Source
var ErrNoSigner = errors.New("backup sealer needs a signer")

ErrNoSigner means a Sealer was asked for without a Signer: every backup is signed.

View Source
var ErrRecipient = errors.New("backup recipient must be one age public key")

ErrRecipient means the recipient is not one native age public key.

Functions

This section is empty.

Types

type Opener added in v0.58.0

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

Opener decrypts a dump sealed for one identity: in production, a key drawn for one restore, never the owner's (#297). It implements app.KeyDumpOpener.

func NewOpener added in v0.58.0

func NewOpener(identity string, verifier *Verifier) (*Opener, error)

NewOpener returns an Opener for identity, one native age private key, such as the "AGE-SECRET-KEY-PQ-1…" printed by age-keygen -pq, or ErrIdentity, whose dumps verifier checks. The error never quotes identity.

func (*Opener) OpenDump added in v0.58.0

func (o *Opener) OpenDump(sealed []byte) ([]byte, error)

OpenDump decrypts sealed whole and returns its tar once the signature is verified: age authenticates every chunk and the end of the file, so a dump altered or cut short fails here, and the signature proves the backup job made it, which age cannot.

type Sealer

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

Sealer encrypts backups for one recipient. It implements app.BackupSealer.

func New

func New(recipient string, signer *Signer) (*Sealer, error)

New returns a Sealer for recipient, one native age public key, such as the "age1pq1…" printed by age-keygen -pq, or ErrRecipient. Every dump it seals is signed by signer.

func (*Sealer) Seal

func (s *Sealer) Seal(w io.Writer) (io.WriteCloser, error)

Seal returns a WriteCloser encrypting what is written to it into w; Close appends the signature of what was written, then writes the last chunk.

type Signer added in v0.63.0

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

Signer signs dumps with the private key of the backup job.

func NewSigner added in v0.63.0

func NewSigner(seed string) (*Signer, error)

NewSigner returns a Signer for seed, the hex of a 32-byte Ed25519 seed, or ErrSigningKey. The error never quotes seed.

type Verifier added in v0.63.0

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

Verifier checks the signature of a clear dump. It implements app.KeyDumpOpener for a dump the owner already decrypted.

func NewVerifier added in v0.63.0

func NewVerifier(key string) (*Verifier, error)

NewVerifier returns a Verifier for key, the hex of a 32-byte Ed25519 public key, or ErrVerifyKey.

func (*Verifier) OpenDump added in v0.63.0

func (v *Verifier) OpenDump(dump []byte) ([]byte, error)

OpenDump returns the tar of dump once its signature is verified, or ErrSignature. The tar shares dump's memory.

Jump to

Keyboard shortcuts

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