iqlusioninc / yubikey.rs

Pure Rust YubiKey host-side driver for PIV-based RSA/ECC key storage + signing/encryption support
BSD 2-Clause "Simplified" License
218 stars 27 forks source link

`untested` functionality tracking issue #280

Open tony-iqlusion opened 3 years ago

tony-iqlusion commented 3 years ago

This is a tracking issue for all functionality currently gated under the untested feature.

Please leave a comment here if you were able to use the functionality successfully and/or are interested in writing tests.

ghost commented 3 years ago

I am curious about whether yubikey.rs would support managing the oauth TOTP credentials on a Yubikey (ykman oath). Do the various _object methods cover this behavior or the low-level building blocks?

tony-iqlusion commented 3 years ago

This library is a translation of yubico-piv-tool, and as far as I know that has no support for obtaining OATH-TOTP codes from the OTP applet.

It's something we'd be happy to add. There's some very basic support for interacting with the OTP applet for obtaining version information, but that's it.

I believe there was some support for this in earlier versions of the yubikey crate which had a completely different codebase. If so, perhaps some of that work can be extracted and re-integrated.

tony-iqlusion commented 3 years ago

I went ahead and gisted the source code of the earlier yubikey crate which has OTP support. Here is the relevant function:

https://gist.github.com/tarcieri/3dfb1628a48d39651f313b76d61d5cb2#file-yubikey-rs-L317-L325

The code is written using the (now defunct) libusb crate which is quite a bit different from how this crate works, as we use a portable PC/SC abstraction library. So it'd need to be rewritten to use that instead.

ghost commented 3 years ago

@tony-iqlusion wow, thank you for the detailed guidance! I'll note that gist and explore as I have freer time.