yubirs

Build Status Coverage Status

A library for interacting with YubiKeys in Rust.

Using Yubikeys on Linux

Here are some helpful resources on how to use the Yubikey:

In particular, a few pieces of setup are necessary in order to fully use the Yubikey. OTP mode generally works without any additional setup (since we only rely on the Yubikey's USB keyboard functionality), but for PIV / smartcard features some additional setup is needed.

Arch Linux

```shell sudo pacman -S libu2f-host yubikey-manager pcsclite pcsc-tools ccid libusb-compat

For pcsclite to work, we need to start the pcscd daemon.

sudo systemctl start pcscd.service sudo systemctl enable pcscd.service ```

Gentoo Linux

The process on Gentoo is very similar:

```shell

Install necessary packages.

emerge -av libu2f-host yubikey-manager pcsc-lite pcsc-tools ccid libusb-compat

Add your user to the right group to be able to access the device. Replace

$MY_USER with your username.

gpasswd -a $MY_USER plugdev

Configure hotplugging by setting rc_hotplug="pcscd" in this file:

vim /etc/rc.conf

Start pcscd, and configure it to start on boot.

rc-update add pcscd default /etc/init.d/pcscd start ```

Testing

To verify that everything is setup right, the following commands should both work and print out information about the Yubikey:

shell gpg --card-status pcsc_scan

Yubikey PIV Functionality

yubirs provides a command-line interface, piv-tool, as well as a high-level API for interacting with the Yubikey's PIV functionality. Many of the concepts used may be unfamiliar to those who don't have a lot of experience with the Yubikey. The official upstream documentation provides a good overview of the concepts involved.

Development

This repository includes some extra Git configuration which makes development easier. To use this configuration, run git config --local include.path ../.gitconfig from the repository root. NOTE: including arbitrary Git configurations is a security vulnerability, so you should audit this custom configuration before including it.