tests: Initial connect test and docs

Adds an extremely basic initial test to ensure that we are able to
connect to a YubiKey.

The test is marked `#[ignore]` in the hope that we can eventually start
adding tests which run in CI, e.g. against a mock card.

This also includes a fix for calculating the APDU size, since the ones
we were sending originally were overly long.
This commit is contained in:
Tony Arcieri
2019-11-25 09:45:02 -08:00
parent 4039560d97
commit fd77e9f844
10 changed files with 162 additions and 1309 deletions
+18 -13
View File
@@ -1,15 +1,15 @@
//! [YubiKey][1] PIV: [Personal Identity Verification][2] support for
//! [Yubico][3] devices using the Chip Card Interface Device ([CCID][4])
//! protocol.
//! [Yubico][3] devices using the Personal Computer/Smart Card ([PC/SC][4])
//! interface as provided by the [`pcsc` crate][5].
//!
//! **PIV** is a [NIST][5] standard for both *signing* and *encryption*
//! **PIV** is a [NIST][6] standard for both *signing* and *encryption*
//! using SmartCards and SmartCard-based hardware tokens like YubiKeys.
//!
//! This library natively implements the CCID protocol used to manage and
//! utilize PIV encryption and signing keys which can be generated, imported,
//! and stored on YubiKey devices.
//!
//! See [Yubico's guide to PIV-enabled YubiKeys][6] for more information
//! See [Yubico's guide to PIV-enabled YubiKeys][7] for more information
//! on which devices support PIV and the available functionality.
//!
//! Supported algorithms:
@@ -25,26 +25,31 @@
//! This library is a work-in-progress translation and is not yet usable.
//! Check back later for updates.
//!
//! ## Minimum Supported Rust Version
//!
//! Rust 1.39+
//!
//! ## History
//!
//! This library is a Rust translation of the [yubico-piv-tool][7] utility by
//! This library is a Rust translation of the [yubico-piv-tool][8] utility by
//! Yubico, which was originally written in C. It was mechanically translated
//! from C into Rust using [Corrode][8], and then subsequently heavily
//! from C into Rust using [Corrode][9], and then subsequently heavily
//! refactored into safer, more idiomatic Rust.
//!
//! For more information on `yubico-piv-tool` and background information on how
//! the YubiKey implementation of PIV works in general, see the
//! [Yubico PIV Tool Command Line Guide][9].
//! [Yubico PIV Tool Command Line Guide][10].
//!
//! [1]: https://www.yubico.com/products/yubikey-hardware/
//! [2]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-73-4.pdf
//! [3]: https://www.yubico.com/
//! [4]: https://en.wikipedia.org/wiki/CCID_(protocol)
//! [5]: https://www.nist.gov/
//! [6]: https://developers.yubico.com/PIV/Introduction/YubiKey_and_PIV.html
//! [7]: https://github.com/Yubico/yubico-piv-tool/
//! [8]: https://github.com/jameysharp/corrode
//! [9]: https://www.yubico.com/wp-content/uploads/2016/05/Yubico_PIV_Tool_Command_Line_Guide_en.pdf
//! [4]: https://en.wikipedia.org/wiki/PC/SC
//! [5]: https://github.com/bluetech/pcsc-rust
//! [6]: https://www.nist.gov/
//! [7]: https://developers.yubico.com/PIV/Introduction/YubiKey_and_PIV.html
//! [8]: https://github.com/Yubico/yubico-piv-tool/
//! [9]: https://github.com/jameysharp/corrode
//! [10]: https://www.yubico.com/wp-content/uploads/2016/05/Yubico_PIV_Tool_Command_Line_Guide_en.pdf
// Adapted from yubico-piv-tool:
// <https://github.com/Yubico/yubico-piv-tool/>