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
- age on a PIV slot, interoperable with
age-plugin-yubikeyin both directions - file encryption with the OTP slot in HMAC-SHA1 challenge-response mode
- file encryption with FIDO2
hmac-secret(experimental) - SSHSIG signing, with a FIDO2 (
sk) key or a PIV slot, verifiable withssh-keygen -Y verify - a device report and configuration backup as JSON, with no secrets in it
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:
- Systems: Fedora 44 and Omarchy 4.0.3 (Arch-based), both x86_64.
- Keys: YubiKey 5 NFC (firmware 5.2.6) and YubiKey 5C (firmware 5.4.3).
- Checked against the reference tools: age files interoperate with
age-plugin-yubikey, the HMAC response matchesykman otp calculate, and.yk.encfiles from the old toolkit decrypt. - FIDO2 only works end to end from 0.1.2 on. Earlier releases failed with
CTAP2_ERR_UNSUPPORTED_OPTIONon tokens without built-in user verification, which includes the 5 series. The format is specific toykoxand does not interoperate withage-plugin-fido2-hmac. - Not exercised on hardware:
age setup --generate, a Security Key, and aarch64 with a key (the binary is built and tested in CI, but has never run against one).
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:
- YubiKey #1 - Introdução ao 2FA
- YubiKey #2 - Linux Instalação
- YubiKey #3 - 2FA console terminal, ssh e sudo
- YubiKey #4 - Openssh com yubikey + ed25519
- YubiKey #5 - chaves GPG
- YubiKey na Programação: Guia Completo para SRE, DevOps e Sysadmin
- YubiKey: compilado (com criptografia, Linux e o que mudou de lá para cá)
- age: criptografia de arquivos simples, moderna e segura
- age + yubikey
And in English:
- The Ultimate YubiKey Guide and Setup for Linux
- Beyond GPG: Hardware-Backed File Encryption with age and YubiKey
The code is at github.com/Esl1h/ykoxide and the package at crates.io. MIT licensed.
