Rust library to interact with Security Keys, used by Firefox
Перейти к файлу
John M. Schanck 1959330d90 Bump version to 0.4.1 2024-09-25 15:48:10 -07:00
.github/workflows
examples Add support for WebAuthn PRF extension (#337) 2024-07-25 10:06:59 -07:00
fuzz
src Use rsaEncryption OID for RSA keys 2024-09-04 10:57:32 -07:00
testing
.clippy.toml
.flake8
.gitignore
.pre-commit-config.yaml
.travis.yml
Cargo.toml Bump version to 0.4.1 2024-09-25 15:48:10 -07:00
Cross.toml
LICENSE
README.md
build.rs
rust-toolchain.toml Use Mozilla minimum supported rust version in Github workflows 2023-11-08 11:22:41 -08:00
rustfmt.toml

README.md

A Rust library for interacting with CTAP1/CTAP2 Security Keys

Build Status Maturity Level

This is a cross-platform library for interacting with Security Key-type devices via Rust.

  • Supported Platforms: Windows, Linux, FreeBSD, NetBSD, OpenBSD, and macOS.
  • Supported Transports: USB HID.
  • Supported Protocols: FIDO U2F over USB. CTAP2 support is forthcoming, with work being done in the unstable ctap2 branch.

This library currently focuses on USB security keys, but is expected to be extended to support additional transports.

Usage

There's only a simple example function that tries to register and sign right now. It uses env_logger for logging, which you configure with the RUST_LOG environment variable:

cargo build --example main
RUST_LOG=debug cargo run --example main

Proper usage should be to call into this library from something else - e.g., Firefox. There are some C headers exposed for the purpose.

Tests

There are some tests of the cross-platform runloop logic and the protocol decoder:

cargo test

Fuzzing

There are fuzzers for the USB protocol reader, basically fuzzing inputs from the HID layer. There are not (yet) fuzzers for the C API used by callers (such as Gecko).

To fuzz, you will need cargo-fuzz (the latest version from GitHub) as well as Rust Nightly.

rustup install nightly
cargo install cargo-fuzz

cargo +nightly fuzz run u2f_read -- -max_len=512
cargo +nightly fuzz run u2f_read_write -- -max_len=512