archivecrypt

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package archivecrypt is the format of encrypted archive objects and wrapped data keys (G6-07), shared by the archiver and `wtctl archive decrypt`. Objects are `"WTE1" ‖ nonce(12) ‖ AES-256-GCM(data key, aad = project id text)`; a data key is wrapped as `0x01 ‖ 0x01 ‖ nonce(12) ‖ ciphertext` (the wt-secrets format) under HKDF-SHA256(WT_SECRET_KEY, salt "watchtower", info DataKeyInfo), aad = the project's uuid bytes.

Index

Constants

View Source
const DataKeyInfo = "wt/tenant-data-key/v1"

DataKeyInfo is the HKDF info of the key that wraps data keys.

Variables

View Source
var Magic = []byte("WTE1")

Magic starts every encrypted object.

Functions

func IsEncrypted

func IsEncrypted(b []byte) bool

IsEncrypted reports whether b is an encrypted object (anything else is legacy plaintext).

func NewDataKey

func NewDataKey() ([]byte, error)

NewDataKey is a fresh random 32-byte key.

func Open

func Open(dk []byte, project string, b []byte) ([]byte, error)

Open decrypts an object; data without the magic is returned unchanged.

func Seal

func Seal(dk []byte, project string, data []byte) ([]byte, error)

Seal encrypts an object for project (the uuid text).

func Unwrap

func Unwrap(master string, project uuid.UUID, sealed []byte) ([]byte, error)

Unwrap opens a wrapped data key.

func Wrap

func Wrap(master string, project uuid.UUID, dk []byte) ([]byte, error)

Wrap seals a data key under the master key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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