25 Commits

Author SHA1 Message Date
Robin Krahl
4554cb866e make_credential: Support non-discoverable credentials without PIN
Currently, we always require the PIN to be used for make_credential
operations if it is set.  This patch implements the makeCredUvNotRqd
option that allows non-discoverable credentials to be created without
using the PIN according to § 6.1.2 Step 6 of the specification, see:

https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-makeCred-authnr-alg
https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#getinfo-makecreduvnotrqd

Fixes: https://github.com/Nitrokey/fido-authenticator/issues/34
2025-05-07 22:20:20 +02:00
Robin Krahl
223bc11eec Always reject uv = true in make_credential and get_assertion
This changes the error code if uv = true to InvalidOption even if a PIN
is set.  Previously, we returned PinRequired if a PIN is set.  The new
implementation follows § 6.1.2 Step 5 of the specification more closely.

https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-makeCred-authnr-alg
2025-05-07 21:57:44 +02:00
Robin Krahl
7ff0518b68 hmac-secret: Forbid up=false
Fixes: https://github.com/Nitrokey/fido-authenticator/issues/19
2025-05-07 16:04:44 +02:00
Robin Krahl
91a57756c0 tests: Use hmac-secret extension in TestGetAssertion 2025-05-07 15:54:54 +02:00
Robin Krahl
fed17e9b35 tests: Remove exhaustive dependency 2025-02-19 12:34:23 +01:00
Robin Krahl
2c8efe16c2 tests: Inspect filesystem after test runs 2025-02-19 12:34:22 +01:00
Robin Krahl
dfcaf94096 tests: Add getNextAssertion tests 2025-02-18 10:46:12 +01:00
Robin Krahl
f3679b8dd5 tests: Add changePin tests 2025-02-18 10:46:11 +01:00
Robin Krahl
fd6fc9b8a8 tests: Extend setPin tests 2025-02-18 10:46:11 +01:00
Robin Krahl
726ce464be tests: Add getPinRetries tests 2025-02-18 10:46:11 +01:00
Robin Krahl
add1cebd26 tests: Extend getPinToken tests 2025-02-18 10:46:11 +01:00
Robin Krahl
9e4cd65e54 tests: Extend getAssertion tests 2025-02-18 10:46:11 +01:00
Robin Krahl
10b0334fed tests: Extend makeCredential tests 2025-02-18 10:46:11 +01:00
Robin Krahl
83477813bf tests: Add helper trait and use exhaustive 2025-02-18 10:46:09 +01:00
Robin Krahl
d0885e1ccb Extend credential management tests
This patch adds tests for deleting discoverable credentials and for
updating the user information for existing credentials.
2025-01-21 10:23:25 +01:00
Robin Krahl
e9dfefd715 tests: Add credential management tests
This patch introduces the authenticator module that provides a
simple high-level interface for testing FIDO2 functionality.  It uses
the module to implement tests for credential management, namely for
listing credentials and for the behavior if the credential limit is
reached or the filesystem is full.
2024-10-23 16:00:16 +02:00
Robin Krahl
09271b68b4 Add tests for attestation formats preference 2024-06-27 12:50:58 +02:00
Robin Krahl
30e2b909ad Implement third-party payment extension 2024-06-27 12:50:57 +02:00
Robin Krahl
4f52ab13ab tests: Add get_assertion test 2024-06-27 10:51:33 +02:00
Robin Krahl
ca493254b8 tests: Setup attestation certificate and key 2024-06-24 20:17:44 +02:00
Robin Krahl
07ff03b4ed Accept scoped PIN tokens for EnumerateCredentialsBegin
As described in #80, we currently require PIN tokens without an RP ID
restriction for all credential management operations.  For most
operations, this is correct.

For EnumerateCredentialsBegin, we should also accept a token that
matches the requested RP ID hash.  For DeleteCredential and
UpdateUserInformation, we should also accept a token that matches the
requested credential ID.  As it is not trivial to compare the RP ID hash
or the credential ID against the RP ID set for the PIN token, I did not
handle these cases in the initial implementation.

This led to an incompatibility with libfido2 because it tries to use a
restricted PIN token to enumerate credentials.  With this patch, we
additionally compute the RP ID hash when restricting a PIN token to an
RP ID and use that to validate the PIN token for
EnumerateCredentialsBegin operations.

For DeleteCredential and UpdateUserInformation, we still require tokens
without an RP ID restriction because determining the RP ID from the
credential ID is much harder and this is not known to cause
incompatibility issues.

See also: https://github.com/Nitrokey/fido-authenticator/issues/80
2024-05-23 12:01:39 +02:00
Robin Krahl
a2b0280e93 tests: Add basic tests for credential management 2024-05-22 23:39:57 +02:00
Robin Krahl
efed1896bc tests: Add Request trait and reply types 2024-05-22 22:55:32 +02:00
Robin Krahl
aad05b9573 tests: Handle CTAP2 errors 2024-05-22 11:03:00 +02:00
Robin Krahl
7db98dd731 Setup basic integration tests
This patch adds basic integration tests that use the ctaphid library to
send CTAPHID commands to the authenticator over ctaphid-dispatch.
Unfortunately, usbd-ctaphid does not provide a public interface to its
packet handling code, so we have to copy that code for the time being.
2024-03-21 21:16:42 +01:00