tree: ff3b5ca4815452f4e5ee5d3b7334e775cadf6594 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. OWNERS
  4. README.md
  5. attestation_object.cc
  6. attestation_object.h
  7. attestation_statement.cc
  8. attestation_statement.h
  9. attestation_statement_formats.cc
  10. attestation_statement_formats.h
  11. attestation_statement_formats_unittest.cc
  12. attested_credential_data.cc
  13. attested_credential_data.h
  14. authenticator_data.cc
  15. authenticator_data.h
  16. authenticator_get_assertion_response.cc
  17. authenticator_get_assertion_response.h
  18. authenticator_get_info_response.cc
  19. authenticator_get_info_response.h
  20. authenticator_make_credential_response.cc
  21. authenticator_make_credential_response.h
  22. authenticator_selection_criteria.cc
  23. authenticator_selection_criteria.h
  24. authenticator_supported_options.cc
  25. authenticator_supported_options.h
  26. bio/
  27. ble/
  28. ble_adapter_manager.cc
  29. ble_adapter_manager.h
  30. ble_adapter_manager_unittest.cc
  31. cable/
  32. credential_management.cc
  33. credential_management.h
  34. credential_management_handler.cc
  35. credential_management_handler.h
  36. credential_management_handler_unittest.cc
  37. ctap2_device_operation.h
  38. ctap_empty_authenticator_request.cc
  39. ctap_empty_authenticator_request.h
  40. ctap_get_assertion_request.cc
  41. ctap_get_assertion_request.h
  42. ctap_make_credential_request.cc
  43. ctap_make_credential_request.h
  44. ctap_request_unittest.cc
  45. ctap_response_fuzzer.cc
  46. ctap_response_unittest.cc
  47. device_operation.h
  48. device_response_converter.cc
  49. device_response_converter.h
  50. ec_public_key.cc
  51. ec_public_key.h
  52. fake_fido_discovery.cc
  53. fake_fido_discovery.h
  54. fake_fido_discovery_unittest.cc
  55. features.cc
  56. features.h
  57. fido_authenticator.cc
  58. fido_authenticator.h
  59. fido_constants.cc
  60. fido_constants.h
  61. fido_device.cc
  62. fido_device.h
  63. fido_device_authenticator.cc
  64. fido_device_authenticator.h
  65. fido_device_discovery.cc
  66. fido_device_discovery.h
  67. fido_device_discovery_unittest.cc
  68. fido_discovery_base.cc
  69. fido_discovery_base.h
  70. fido_discovery_factory.cc
  71. fido_discovery_factory.h
  72. fido_parsing_utils.cc
  73. fido_parsing_utils.h
  74. fido_parsing_utils_unittest.cc
  75. fido_request_handler.h
  76. fido_request_handler_base.cc
  77. fido_request_handler_base.h
  78. fido_request_handler_unittest.cc
  79. fido_strings.grd
  80. fido_task.cc
  81. fido_task.h
  82. fido_test_data.h
  83. fido_transport_protocol.cc
  84. fido_transport_protocol.h
  85. get_assertion_handler_unittest.cc
  86. get_assertion_request_handler.cc
  87. get_assertion_request_handler.h
  88. get_assertion_task.cc
  89. get_assertion_task.h
  90. get_assertion_task_unittest.cc
  91. hid/
  92. mac/
  93. make_credential_handler_unittest.cc
  94. make_credential_request_handler.cc
  95. make_credential_request_handler.h
  96. make_credential_task.cc
  97. make_credential_task.h
  98. make_credential_task_unittest.cc
  99. mock_fido_device.cc
  100. mock_fido_device.h
  101. mock_fido_discovery_observer.cc
  102. mock_fido_discovery_observer.h
  103. opaque_attestation_statement.cc
  104. opaque_attestation_statement.h
  105. opaque_public_key.cc
  106. opaque_public_key.h
  107. pin.cc
  108. pin.h
  109. pin_internal.h
  110. platform_credential_store.h
  111. public_key.cc
  112. public_key.h
  113. public_key_credential_descriptor.cc
  114. public_key_credential_descriptor.h
  115. public_key_credential_params.cc
  116. public_key_credential_params.h
  117. public_key_credential_rp_entity.cc
  118. public_key_credential_rp_entity.h
  119. public_key_credential_user_entity.cc
  120. public_key_credential_user_entity.h
  121. reset_request_handler.cc
  122. reset_request_handler.h
  123. response_data.cc
  124. response_data.h
  125. response_data_fuzzer_corpus/
  126. set_pin_request_handler.cc
  127. set_pin_request_handler.h
  128. strings/
  129. test_callback_receiver.h
  130. test_callback_receiver_unittest.cc
  131. u2f_command_constructor.cc
  132. u2f_command_constructor.h
  133. u2f_command_constructor_unittest.cc
  134. u2f_register_operation.cc
  135. u2f_register_operation.h
  136. u2f_register_operation_unittest.cc
  137. u2f_sign_operation.cc
  138. u2f_sign_operation.h
  139. u2f_sign_operation_unittest.cc
  140. virtual_ctap2_device.cc
  141. virtual_ctap2_device.h
  142. virtual_fido_device.cc
  143. virtual_fido_device.h
  144. virtual_fido_device_factory.cc
  145. virtual_fido_device_factory.h
  146. virtual_u2f_device.cc
  147. virtual_u2f_device.h
  148. win/
device/fido/README.md

Security Keys

Security keys are physical devices that often connect via USB and have a button. They can generate public keys and sign with them to authenticate a user and are most often used as a second factor for security.

Websites interact with them via two APIs: the older U2F API and the modern W3C Webauthn API. In Chromium, the U2F API is not directly supported but it can be used by using postMessage with an internal extension called cryptotoken. Webauthn is supported by Blink and is part of CredMan.

(Historically cryptotoken contained a complete stack that interacted with USB devices directly. Now, however, it's a wrapper layer over the Webauthn APIs.)

Several different types of security keys are supported. Older security keys implement the U2F protocol while more modern ones implement CTAP2. These devices can work over USB, Bluetooth Low Energy (BLE), or NFC (not supported). Additionally Chromium contains support for using Touch ID on macOS as a security key as well support for forwarding requests to the native libraries on modern versions of Windows.

Life of a request

This section provides a coarse roadmap for understanding the code involved in security key support by highlighting the path that a login request might take.

Firstly, the CredMan get call ends up in CredentialsContainer::get. CredMan supports several types of credentials but the code dealing with publicKey relates to security key support.

The request is packaged into a Mojo call defined in authenticator.mojom. On Android, that Mojo request is handled by Android-specific code and is forwarded to support libraries in Google Play Services. Otherwise the Mojo interface will be bound to AuthenticatorCommon; specifically it'll call AuthenticatorCommon::GetAssertion.

AuthenticatorCommon is part of Chromium‘s content layer and so calls into the embedder to get a delegate object that allows it to perform actions like showing UI. It also triggers the lower-level code to start the process of finding an authenticator to handle the request. For an assertion request it’ll create a GetAssertionRequestHandler from this directory.

The Handler classes manage a specific user action and their first job is to initiate discovery of possible security keys. The discovery process will find candidate USB, BLE, Touch ID, etc devices, each of which will be fed into DispatchRequest. Different actions may be taken depending on features of the discovered authenticator. For example, an authenticator which cannot handle the request may be asked to wait for a touch so that the user can still select it, even though it'll cause the request to fail. These per-authenticator operations will be dispatched via the abstract FidoAuthenticator interface.

If a per-authenticator operation is complex and requires several steps it will be handled by a “task”. In this example, a GetAssertionTask will likely be created by a FidoDeviceAuthenticator, the implementation of FidoAuthenticator used by physical devices.

The assertion task knows how to sequence a series of U2F or CTAP2 operations to implement an assertion request. In the case of U2F, there will be another layer of state machines in, e.g., U2fSignOperation because U2F has a historical authenticator model.

If interaction with UI is required, for example to prompt for a PIN, the handler will make calls via the Observer interface, which is implemented by the embedder's UI objects that were created by AuthenticatorCommon.

Settings

It's also possible for security key operations to be triggered by actions in the Settings UI: there are several security key actions that can be taken on chrome://settings/securityKeys. In this case, calls from the Javascript that implements the Settings UI end up in SecurityKeysHandler, which then operates in the same way as AuthenticatorCommon, albeit without creating any native UI.

Fuzzers

libFuzzer tests are in *_fuzzer.cc files. They test for bad input from devices, e.g. when parsing responses to register or sign operations.