Skip to content
אצלי
Go back

ykoxide: my YubiKey toolbox, rewritten as a single Rust binary

Close-up de uma mão segurando uma chave comum de cabeça preta, com uma pequena chave de segurança USB preta, de ícone de chave e contatos dourados, presa ao mesmo chaveiro, sobre um fundo cinza claro
Foto de cottonbro studio na Pexels

Also available in Portuguese: ykoxide: a minha caixa de ferramentas da YubiKey virou um binário em Rust.

In the YubiKey series I went from 2FA-because-you-have-to to sudo, SSH and GPG, and ended up at file encryption with age. The scripts from that phase live in yubikey-shell-toolkit. They work, but they depend on ykman, age and openssl being installed.

ykoxide is the Rust rewrite: a single binary, ykox, with none of those runtime dependencies. It reads the files and configuration the scripts created, so what you already encrypted keeps opening.

What it does

Basic usage:

ykox info                        # is the key detected?
ykox age setup                   # extract (or generate) the age identity on the key
ykox age encrypt secret.txt      # secret.txt.age
ykox age decrypt secret.txt.age
ykox sign report.pdf             # report.pdf.sig

With more than one YubiKey plugged in, --serial <N> picks which one to use. FIDO2 is the exception, because its HID interface does not report a serial.

Installation

cargo install ykoxide --locked   # builds from source
cargo binstall ykoxide           # downloads the release binary instead

Tarballs for Linux x86_64 and aarch64 are also on the releases page, with SHA256SUMS and, from 0.1.1 on, a build provenance attestation. Tags are GPG-signed.

At runtime it needs pcscd running (sudo systemctl enable --now pcscd.socket). On Arch, also install pcsclite and ccid; on Fedora, pcsc-lite and pcsc-lite-ccid. Building needs the PC/SC and udev headers.

What was tested

It is still pre-1.0, and the README spells out exactly what was exercised on hardware:

Two security notes worth repeating here. ykox protects the key material, not the plaintext: malware on the host that reads the already decrypted file is still your problem. And the legacy .yk.enc format is unauthenticated, so a wrong key passes about 1 time in 256. Always prefer .yk.age.

The YubiKey series on this blog

If you landed here without the background, this is the order. The first group is in Portuguese:

And in English:

The code is at github.com/Esl1h/ykoxide and the package at crates.io. MIT licensed.


Share this post on:

Previous Post
An API client inside Standard Notes, with .http syntax and end-to-end encryption
Next Post
ykoxide: a minha caixa de ferramentas da YubiKey virou um binário em Rust