Rust library to interact with Security Keys, used by Firefox
Перейти к файлу
John M. Schanck 1db6dd29b0 Allow COSEAlgorithm::ECDH_ES_HKDF256 in COSEKey::generate 2023-06-14 13:51:40 -07:00
.github/workflows Fix clippy warnings and run clippy in CI 2023-01-12 13:01:46 -08:00
examples Type visibility changes for virtual authenticators 2023-06-14 12:13:28 -07:00
fuzz Add authenticator USB and Firmware details to the C API 2020-08-10 14:49:25 -07:00
src Allow COSEAlgorithm::ECDH_ES_HKDF256 in COSEKey::generate 2023-06-14 13:51:40 -07:00
testing edition 2018 fix for OpenBSD 2020-08-06 13:46:22 -07:00
webdriver-tools Add all WebDriver methods to control TestToken 2020-09-17 10:22:17 -07:00
.clippy.toml Rebase on v0.3.0 new errors, etc. 2020-09-17 10:22:17 -07:00
.flake8 WebDriver implementation 2020-09-17 10:22:17 -07:00
.gitignore Fix #35 - Run Clippy at TravisCI, and clean up Clippy warnings (#70) 2018-10-25 12:00:37 +02:00
.pre-commit-config.yaml WebDriver implementation 2020-09-17 10:22:17 -07:00
.travis.yml Rust 1.46 clippy fixes (#135) 2020-09-17 10:48:39 -07:00
Cargo.toml Add support for ECDSA over P256 using NSS 2023-06-14 13:51:40 -07:00
Cross.toml Add cross cross-platform testing tools 2020-07-27 13:17:46 -07:00
LICENSE Add pre-commit 2020-01-21 21:56:11 -07:00
README.md Fix fuzzing targets to use stable cargo-fuzz 2020-07-27 13:17:16 -07:00
build.rs Add LoongArch64 support 2023-05-30 21:35:25 -07:00
rustfmt.toml Add all WebDriver methods to control TestToken 2020-09-17 10:22:17 -07:00

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