Commit Graph

81 Commits

Author SHA1 Message Date
Martin Sirringhaus b5beeeea45 Use workaround for broken generic array 0.14.9 by using the new version in compat-mode 2025-10-23 08:29:10 -07:00
Martin Sirringhaus d62d60266f Adding tests (and some minor fixes the tests revealed) 2025-10-23 08:29:10 -07:00
Martin Sirringhaus 170217a934 Add largeBlobKeys-extension 2025-10-23 08:29:10 -07:00
Martin Sirringhaus ec98cd0ca1 Add credBlob-extension 2025-10-23 08:29:10 -07:00
Emil Lundberg c3defd344c Add support for WebAuthn PRF extension (#337)
* Add support for WebAuthn PRF extension

Original context: https://bugzilla.mozilla.org/show_bug.cgi?id=1863819

* Send correct PIN protocol ID in hmac-secret

Before this change, OpenSK (tag 2.1, commit
893faa5113f47457337ddb826b1a58870f00bc78) returns CTAP2_ERR_INVALID_PARAMETER in
response to attempts to use the WebAuthn PRF extension.

Original context: https://bugzilla.mozilla.org/show_bug.cgi?id=1863819

* Extract function HmacSecretResponse::decrypt_secrets

* Clarify and correct hmac-secret and PRF client outputs in makeCredential

* Delete unnecessary impl Default

* Rename HmacSecretFromHmacSecretOrPrf to HmacCreateSecretOrPrf

* Use HmacGetSecretOrPrf data model in getAssertion too

* Add examples/prf.rs

* Construct channels outside loop

* Remove unused loop

* Add tests for HmacSecretResponse::decrypt_secrets

* Extract function AuthenticationExtensionsPRFInputs::eval_to_salt

* Extract AuthenticationExtensionsPRFInputs::select_eval and ::select_credential

* Add doc comment to AuthenticationExtensionsPRFInputs::calculate

* Fix clippy lint

* Return empty prf output if no eval or evalByCredential entry matched

* Extract function HmacGetSecretOrPrf::calculate

* Add tests of calculating hmac-secret/PRF inputs

* Fix outdated error messages

* Separate hmac_secret tests that require a crypto backend

* Add debug output to error paths of HmacSecretResponse::decrypt_secrets

* Fix a typo and a cryptic comment

* Eliminate unnecessary sha256 function

* Simplify to Sha256::digest where possible

* Derive PartialEq always, not just in cfg(test)

* Document generation of hmac_secret test data

* Remove unnecessary comma

* Tweak imports per review

* Take PinUvAuthToken as reference in HmacSecretExtension::calculate

* Deduplicate decrypt_pin_token code in tests

* Extract function GetAssertion::process_hmac_secret_and_prf_extension

* Move allow_list assignment to top level scope

* Add tests of hmac-secret and prf processing in GetAssertion::finalize_result

* Fail hmac-secret salt calculation if input salts are too long

This is prescribed by the [CTAP spec][ctap]:

>**Client extension processing**
>1. [...]
>2. If present in a get():
>  1. Verify that salt1 is a 32-byte ArrayBuffer.
>  2. If salt2 is present, verify that it is a 32-byte ArrayBuffer.
>  [...]

[ctap]: https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-hmac-secret-extension

* Add tests of GetAssertion::process_hmac_secret_and_prf_extension

* Propagate WrongSaltLength as InvalidRelyingPartyInput in GetAssertion::process_hmac_secret_and_prf_extension

* Return PrfUnmatched instead of None when shared secret is not available

This is needed because the PRF extension should return an empty extension output
`prf: {}` when the extension is processed but no eligible authenticator is
found. Thus we need to differentiate these cases so that
`GetAssertion::finalize_result` can match on `PrfUnmatched` and generate the
empty output.

* Add debug logging when no shared secret is available

* Add debug logging when hmac-secret output decryption fails

* Add test of serializing uninitialized and unmatched PRF inputs

* Add missing test of serializing hmac-secret with PIN protocol 2
2024-07-25 10:06:59 -07:00
John M. Schanck d3a0d09f48 Add StatusUpdate::SelectResultNotice 2023-09-19 15:39:26 -07:00
John M. Schanck 5d20800714 Rename User to PublicKeyCredentialUserEntity 2023-09-19 15:39:26 -07:00
John M. Schanck 8f4914023e Update support for hmac-secret extension in MakeCredentials 2023-09-11 09:39:09 -07:00
John M. Schanck 1a1d712e9e rustfmt 2023-09-11 09:39:09 -07:00
John M. Schanck b2b2fb3977 Add support for the credProtect extension 2023-09-11 09:39:09 -07:00
John M. Schanck bbba54700e Add support for the minPinLength extension 2023-09-11 09:39:09 -07:00
John M. Schanck d512ad9b5d Rework support for AppId extension 2023-09-11 09:39:09 -07:00
John M. Schanck a00fd64edc Add support for the credProps extension 2023-09-11 09:39:09 -07:00
Martin Sirringhaus dbdc97f786 Fix typo 2023-09-07 11:28:51 -07:00
John M. Schanck 55a6bca36d Improve CTAP2 support of AppID extension 2023-08-24 09:17:06 -07:00
John M. Schanck 12ae64d141 Skip device selection when useful credentials are discovered silently 2023-08-24 09:17:06 -07:00
John M. Schanck 0a00a250ae Remove webdriver feature now that it has been moved to Firefox 2023-08-23 10:54:34 -07:00
John M. Schanck d160f94e53 Remove icon field from WebAuthn PublicKeyCredentialEntitys 2023-08-21 13:10:03 -07:00
John M. Schanck 2ed7fcc7cf Use AttestationObject in MakeCredentialsResult 2023-08-15 13:26:00 -07:00
John M. Schanck bda39d6a10 Separate serialization routines for AttestationObject and MakeCredentialsResult 2023-08-15 13:26:00 -07:00
Martin Sirringhaus d755f8bcf4 Implement InteractiveRequest::Quit to be able to cleanly stop managing 2023-08-15 13:03:09 -07:00
Martin Sirringhaus 6d03262e7c Handle pinuv-crypto errors and do not show UpdateUser as an option for 2.1_PRE-devices 2023-08-15 13:03:09 -07:00
Martin Sirringhaus 6f7a57e69f Send PUAT back and forth to avoid multiple PIN-requests for the user when doing management-operations 2023-08-15 13:03:09 -07:00
Martin Sirringhaus 99e5930009 Implement (and fix) all possible operations for CredManagement and BioEnrollment to interactive-example 2023-08-15 13:03:09 -07:00
Martin Sirringhaus 47d82fdc64 Fix wrong copy&paste comments and do not copy large_blob_keys 2023-08-15 13:03:09 -07:00