Nitrokey / trussed-secrets-app

Secrets App: OTP and PWS application for the Nitrokey 3
Apache License 2.0
7 stars 4 forks source link
nitrokey-3

Secrets App

A Trussed app to manage OTP and Password Safe features of Nitrokey 3.

Based on oath-authenticator, an implementation of reverse-engineered specification of Yubico's OATH application.

Current Features

Secrets App supports the following features:

The pynitrokey library can be used to communicate with this application over CTAPHID, and nitropy provides the CLI using it. See ctaphid.md for the details.

CCID transport is also available, and while not supported in the mentioned library yet, it can be potentially used by the protocol-compatible applications, like the mentioned KeepassXC.

See design.md for the UX design choices.

OTP

OTP support works reasonably well, with the following remarks:

  1. Shared secret key length can be 320 bits (40 bytes) or longer.
  2. HOTP implementation allows using only 32 bit counter for the initialization as of now.
  3. Usage confirmation through the touch button gesture (aka UP confirmation) can be set during the credential registration.
  4. Additional protection in a means of PIN-based encryption can be additionally set up.

Reverse HOTP

Reverse HOTP is an operation that allows to verify the HOTP code coming from a PC host, and shows visually to user, that the code is correct or not, with a green or red LED respectively. Does not need authorization by design, so the process would be automatically executed during the boot, without any additional user intervention when possible.

This is used for the Measured Boot feature provided by Heads, which in turn is used in Nitrokey Nitropads. With that, the Nitrokey 3 could be used in place of the sold until now Nitrokey Pro and Nitrokey Storage.

See the original description at:

Solution contains means to avoid desynchronization between the host's and device's counters. Device calculates up to 9 values ahead of its current counter to find the matching code (in total it calculates HOTP code for 10 subsequent counter positions). In case:

Device will stop verifying the HOTP codes, when the difference between the host and on-device counters will be greater or equal to 9.

Credentials registered to use with this operation cannot be used with regular HOTP calls by design.

Password Safe

A Password Safe credential can store login, password and additional information, each having maximum 128 bytes. Credentials can be encrypted and/or require touch button press before reading.

KeepassXC support With HMAC-SHA1

KeepassXC is supported through the Yubikey's HMAC-SHA1 challenge commands. Both slots are supported. What's more, any number of credentials can be created of this kind to support other HMAC-SHA1 applications. There is no other support for Yubikey commands planned, nor tested. In fact, the authorization method used by Yubikey is removed, which will probably make it not working with the clients supporting this protocol.

CTAPHID Extension

This implementation uses CTAPHID to transfer commands to the Secrets App application. This transport is used to improve compatibility on platforms, where the default transport for this application, CCID, is not easily available ( e.g. due to being taken by other services, or requiring Administrator privileges). A CTAPHID vendor command number was selected to use (0x70), thus allowing for a compatible extension of any FIDO compliant device.

See CTAPHID for the further documentation regarding the NLnet funded CTAPHID extension.

Further work

While most of the features needed for the daily use are implemented, there are still some tasks to do:

Tasks and features still discussed to be done:

Development

See design document to see decisions taken to make the solution cohesive.

Use dangerous_disable_encryption Rust flag to disable data encryption for the debug purposes. E.g.:

$ env RUSTFLAGS="--cfg dangerous_disable_encryption" cargo test

License

oath-authenticator is licensed under either of Apache License, Version 2.0 or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Funding

Logo NLnet: abstract logo of four people seen from above Logo NGI Zero: letterlogo shaped like a tag

Changes in this project were funded through the NGI0 PET Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825310.