Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

102.10. age-1.3.2

File encryption tool

Version 1.3.2, release 1
Shelf security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit
Phase 41_system (System), 934 of 1047 in build order
Licence BSD-3-Clause
Homepage https://age-encryption.org/
Build time 0.3 SBU
Installed size 13.7 MiB in 9 files
Recipe ports/core/security/age/kpkgbuild

About

age is a small file encryption tool with short explicit keys and no configuration options. An age recipient is a short line (age1…) that can be read out over a phone, and a file can be encrypted to several recipients, to SSH public keys, or to a passphrase. The package holds age, age-keygen, age-inspect, which prints an encrypted file’s recipient types and size breakdown without decrypting it, and age-plugin-batchpass, a plugin for passphrase encryption that takes the passphrase from the environment rather than a terminal; each comes with its manual page.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/security.txt:

One key format, no options, no key server to be unreachable — an age recipient is a short line somebody can read over a phone.

Sources

Dependencies

Depends on: go.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install age'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/age.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/security/age
echo 'b07c28c6c4bdafa272073a310b75bc22c49da8904585a89c30e5ca4233e63843  age-1.3.2.tar.gz' | sha256sum -c -
echo '78b8092d9848afd7fe4048dca756d79fe736760ebe953116857a7b6a07d2efa7  age-vendor-1.3.2.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/age
SRC=$SRC_ROOT/age-1.3.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf age-1.3.2.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz

export CGO_ENABLED=0
for cmd in age age-keygen age-inspect age-plugin-batchpass; do
	go build -mod=vendor -ldflags "-s -w -X main.Version=v$version" -o $cmd ./cmd/$cmd
	install -Dm755 $cmd $PKG/usr/bin/$cmd
	install -Dm644 doc/$cmd.1 $PKG/usr/share/man/man1/$cmd.1
done

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/age, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf age-1.3.2-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/age, and runs the triggers its paths call for.

Contents

Installed programs: age, age-inspect, age-keygen, age-plugin-batchpass.

Installed directories: /usr/share/licenses/age.

Short descriptions

age simple, modern, and secure file encryption
age-inspect inspect age(1) encrypted files
age-keygen generate age(1) key pairs
age-plugin-batchpass non-interactive passphrase encryption plugin for age(1)

Notes

The Go modules come from the vendor bundle, age-vendor-<version>.tar.xz, which ports/fetch makes with go mod vendor because the recipe says vendoring = go; build.sh unpacks it and builds with -mod=vendor, offline. See Vendoring.

The loop builds each command from ./cmd/<name> and installs it with its page from doc/<name>.1. A command added upstream reaches the package only when its name is added to the loop, and the build fails if a listed command has no page.