• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..12-Nov-2020-

bio/H12-Nov-2020-1,3391,038

ble/H12-Nov-2020-4,9963,743

cable/H12-Nov-2020-4,4463,349

cros/H12-Nov-2020-422318

hid/H12-Nov-2020-3,1792,313

mac/H12-Nov-2020-3,6102,715

response_data_fuzzer_corpus/H03-May-2022-

strings/H12-Nov-2020-414411

win/H12-Nov-2020-1,8811,450

BUILD.gnH A D07-Nov-20209.7 KiB381353

DEPSH A D07-Nov-2020248 1312

OWNERSH A D07-Nov-2020741 2920

README.mdH A D07-Nov-20205.8 KiB3920

attestation_object.ccH A D07-Nov-20204 KiB11687

attestation_object.hH A D07-Nov-20202.9 KiB9246

attestation_statement.ccH A D07-Nov-20201.1 KiB4729

attestation_statement.hH A D07-Nov-20203 KiB8440

attestation_statement_formats.ccH A D07-Nov-20207.3 KiB221168

attestation_statement_formats.hH A D07-Nov-20202.4 KiB7248

attestation_statement_formats_unittest.ccH A D07-Nov-20206.1 KiB11499

attested_credential_data.ccH A D07-Nov-20204.7 KiB13694

attested_credential_data.hH A D07-Nov-20202.5 KiB8142

authenticator_data.ccH A D07-Nov-20204.5 KiB136106

authenticator_data.hH A D07-Nov-20204 KiB12669

authenticator_get_assertion_response.ccH A D07-Nov-20203.3 KiB10175

authenticator_get_assertion_response.hH A D07-Nov-20203.2 KiB8761

authenticator_get_info_response.ccH A D07-Nov-20202.6 KiB8560

authenticator_get_info_response.hH A D07-Nov-20201.9 KiB5334

authenticator_make_credential_response.ccH A D07-Nov-20204.4 KiB12190

authenticator_make_credential_response.hH A D07-Nov-20204 KiB10758

authenticator_selection_criteria.ccH A D07-Nov-20201.6 KiB4126

authenticator_selection_criteria.hH A D07-Nov-20202.3 KiB6547

authenticator_supported_options.ccH A D07-Nov-20203.1 KiB9473

authenticator_supported_options.hH A D07-Nov-20203.9 KiB9950

ble_adapter_manager.ccH A D07-Nov-20203.4 KiB10276

ble_adapter_manager.hH A D07-Nov-20202.2 KiB6440

ble_adapter_manager_unittest.ccH A D07-Nov-202011.3 KiB297236

cbor_extract.ccH A D07-Nov-20206.4 KiB215169

cbor_extract.hH A D07-Nov-202010.4 KiB299171

cbor_extract_unittest.ccH A D07-Nov-20205.7 KiB186150

client_data.ccH A D07-Nov-20206.9 KiB219178

client_data.hH A D07-Nov-20202.4 KiB6940

credential_management.ccH A D07-Nov-202014.1 KiB383326

credential_management.hH A D07-Nov-20207.9 KiB228168

credential_management_handler.ccH A D07-Nov-202011.2 KiB322268

credential_management_handler.hH A D07-Nov-20205.3 KiB14599

credential_management_handler_unittest.ccH A D07-Nov-20207.4 KiB179140

ctap2_device_operation.hH A D07-Nov-20208.1 KiB215155

ctap_empty_authenticator_request.ccH A D07-Nov-2020501 209

ctap_empty_authenticator_request.hH A D07-Nov-20201.8 KiB6442

ctap_get_assertion_request.ccH A D07-Nov-20207.9 KiB233183

ctap_get_assertion_request.hH A D07-Nov-20203.2 KiB8856

ctap_make_credential_request.ccH A D07-Nov-202010 KiB298239

ctap_make_credential_request.hH A D07-Nov-20203.9 KiB10162

ctap_request_unittest.ccH A D07-Nov-20204.1 KiB9072

ctap_response_fuzzer.ccH A D07-Nov-20202.6 KiB7352

ctap_response_unittest.ccH A D07-Nov-202026.3 KiB712498

device_operation.hH A D07-Nov-20202.6 KiB8254

device_response_converter.ccH A D07-Nov-202019.4 KiB614473

device_response_converter.hH A D07-Nov-20202.3 KiB5930

ec_public_key.ccH A D07-Nov-20202.4 KiB7853

ec_public_key.hH A D07-Nov-20201.7 KiB5931

fake_fido_discovery.ccH A D07-Nov-20203.6 KiB11184

fake_fido_discovery.hH A D07-Nov-20204.9 KiB13957

fake_fido_discovery_unittest.ccH A D07-Nov-20206.2 KiB181137

features.ccH A D07-Nov-20202.5 KiB7656

features.hH A D07-Nov-20202.1 KiB6536

fido_authenticator.ccH A D07-Nov-20203.6 KiB134103

fido_authenticator.hH A D07-Nov-202010 KiB219141

fido_constants.ccH A D07-Nov-20202.8 KiB7456

fido_constants.hH A D07-Nov-202015.6 KiB379245

fido_device.ccH A D07-Nov-20202.8 KiB9167

fido_device.hH A D07-Nov-20205.7 KiB14269

fido_device_authenticator.ccH A D07-Nov-202027.4 KiB727598

fido_device_authenticator.hH A D07-Nov-20207.8 KiB185155

fido_device_discovery.ccH A D07-Nov-20204 KiB133101

fido_device_discovery.hH A D07-Nov-20202.5 KiB8855

fido_device_discovery_unittest.ccH A D07-Nov-20206.6 KiB181138

fido_discovery_base.ccH A D07-Nov-2020465 189

fido_discovery_base.hH A D07-Nov-20202.8 KiB8247

fido_discovery_factory.ccH A D07-Nov-20204.2 KiB134103

fido_discovery_factory.hH A D07-Nov-20203.2 KiB9458

fido_parsing_utils.ccH A D07-Nov-20203.9 KiB11791

fido_parsing_utils.hH A D07-Nov-20205.5 KiB14692

fido_parsing_utils_unittest.ccH A D07-Nov-202011.2 KiB287228

fido_request_handler_base.ccH A D07-Nov-202014.8 KiB410295

fido_request_handler_base.hH A D07-Nov-202012.6 KiB314171

fido_request_handler_unittest.ccH A D07-Nov-202030.7 KiB769591

fido_strings.grdH A D07-Nov-202011.8 KiB194183

fido_task.ccH A D07-Nov-2020723 2716

fido_task.hH A D07-Nov-20201.5 KiB5628

fido_test_data.hH A D07-Nov-202079.9 KiB1,6951,179

fido_transport_protocol.ccH A D07-Nov-20202 KiB5847

fido_transport_protocol.hH A D07-Nov-20201.6 KiB5130

fido_types.hH A D07-Nov-20201.5 KiB5427

get_assertion_handler_unittest.ccH A D07-Nov-202035.6 KiB856683

get_assertion_request_handler.ccH A D07-Nov-202029.3 KiB778616

get_assertion_request_handler.hH A D07-Nov-20205.2 KiB13698

get_assertion_task.ccH A D07-Nov-20209.9 KiB260194

get_assertion_task.hH A D07-Nov-20203.5 KiB10463

get_assertion_task_unittest.ccH A D07-Nov-202011.6 KiB292233

make_credential_handler_unittest.ccH A D07-Nov-202029.2 KiB715570

make_credential_request_handler.ccH A D07-Nov-202030.2 KiB808646

make_credential_request_handler.hH A D07-Nov-20205 KiB137104

make_credential_task.ccH A D07-Nov-202014.1 KiB353242

make_credential_task.hH A D07-Nov-20203.9 KiB10765

make_credential_task_unittest.ccH A D07-Nov-20207.6 KiB197158

mock_fido_device.ccH A D07-Nov-20206.7 KiB205165

mock_fido_device.hH A D07-Nov-20204.5 KiB11472

mock_fido_discovery_observer.ccH A D07-Nov-2020398 135

mock_fido_discovery_observer.hH A D07-Nov-20201.4 KiB4430

opaque_attestation_statement.ccH A D07-Nov-20202.1 KiB6949

opaque_attestation_statement.hH A D07-Nov-20201.2 KiB4024

opaque_public_key.ccH A D07-Nov-2020592 2111

opaque_public_key.hH A D07-Nov-20201.2 KiB4020

pin.ccH A D07-Nov-202019.3 KiB530395

pin.hH A D07-Nov-20207.4 KiB236130

pin_internal.hH A D07-Nov-20202.8 KiB8748

platform_credential_store.hH A D07-Nov-20201.4 KiB3917

public_key.ccH A D07-Nov-2020424 198

public_key.hH A D07-Nov-2020928 3921

public_key_credential_descriptor.ccH A D07-Nov-20203.1 KiB9164

public_key_credential_descriptor.hH A D07-Nov-20202.5 KiB7151

public_key_credential_params.ccH A D07-Nov-20203 KiB8359

public_key_credential_params.hH A D07-Nov-20201.9 KiB5637

public_key_credential_rp_entity.ccH A D07-Nov-20202.9 KiB9269

public_key_credential_rp_entity.hH A D07-Nov-20201.7 KiB5133

public_key_credential_user_entity.ccH A D07-Nov-20203.5 KiB10778

public_key_credential_user_entity.hH A D07-Nov-20202 KiB5536

reset_request_handler.ccH A D07-Nov-20202.3 KiB7253

reset_request_handler.hH A D07-Nov-20202.6 KiB7344

response_data.ccH A D07-Nov-20201.1 KiB3621

response_data.hH A D07-Nov-20201.2 KiB5230

set_pin_request_handler.ccH A D07-Nov-20204.7 KiB148115

set_pin_request_handler.hH A D07-Nov-20204.2 KiB11061

test_callback_receiver.hH A D07-Nov-20204.1 KiB13581

test_callback_receiver_unittest.ccH A D07-Nov-20205.2 KiB172122

u2f_command_constructor.ccH A D07-Nov-20204.8 KiB128101

u2f_command_constructor.hH A D07-Nov-20203.2 KiB7641

u2f_command_constructor_unittest.ccH A D07-Nov-20206.5 KiB167127

u2f_register_operation.ccH A D07-Nov-20207.2 KiB211163

u2f_register_operation.hH A D07-Nov-20202.3 KiB7144

u2f_register_operation_unittest.ccH A D07-Nov-202011 KiB272199

u2f_sign_operation.ccH A D07-Nov-20207.1 KiB202155

u2f_sign_operation.hH A D07-Nov-20202.2 KiB6744

u2f_sign_operation_unittest.ccH A D07-Nov-202016.6 KiB407310

virtual_ctap2_device.ccH A D07-Nov-202069.3 KiB1,8081,502

virtual_ctap2_device.hH A D07-Nov-20207.5 KiB183106

virtual_ctap2_device_unittest.ccH A D07-Nov-20205.4 KiB141115

virtual_fido_device.ccH A D07-Nov-202010.8 KiB282213

virtual_fido_device.hH A D07-Nov-202010.7 KiB274131

virtual_fido_device_factory.ccH A D07-Nov-20202.9 KiB9474

virtual_fido_device_factory.hH A D07-Nov-20202 KiB5833

virtual_u2f_device.ccH A D07-Nov-20209.1 KiB262188

virtual_u2f_device.hH A D07-Nov-20201.6 KiB5736

virtual_u2f_device_unittest.ccH A D07-Nov-20201.8 KiB6342

README.md

1# Security Keys
2
3Security 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.
4
5Websites interact with them via two APIs: the older [U2F API](https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-javascript-api-v1.2-ps-20170411.html) and the modern [W3C Webauthn API](https://www.w3.org/TR/webauthn/). In Chromium, the U2F API is not directly supported but it can be used by using `postMessage` with an internal extension called [cryptotoken](/chrome/browser/resources/cryptotoken/). Webauthn is supported by Blink and is part of [CredMan](https://www.w3.org/TR/credential-management-1/).
6
7(Historically cryptotoken contained a complete stack that interacted with USB devices directly. Now, however, it's a wrapper layer over the Webauthn APIs.)
8
9Several different types of security keys are supported. Older security keys implement the [U2F protocol](https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.html) while more modern ones implement [CTAP2](https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html). 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.
10
11## Life of a request
12
13This section provides a coarse roadmap for understanding the code involved in security key support by highlighting the path that a login request might take.
14
15Firstly, the CredMan `get` call ends up in [`CredentialsContainer::get`](https://cs.chromium.org/search/?q=symbol:CredentialsContainer::get+exact:yes&det=matsel&sq=package:chromium&type=cs). CredMan supports several types of credentials but the code dealing with `publicKey` relates to security key support.
16
17The request is packaged into a Mojo call defined in [authenticator.mojom](/third_party/blink/public/mojom/webauthn/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`](/content/browser/webauth/authenticator_common.cc); specifically it'll call [`AuthenticatorCommon::GetAssertion`](https://cs.chromium.org/search/?q=symbol:AuthenticatorCommon::GetAssertion+exact:yes&sq=package:chromium).
18
19AuthenticatorCommon is part of Chromium's [content layer](https://www.chromium.org/developers/content-module) and so [calls into the embedder](https://cs.chromium.org/search/?q=symbol:GetWebAuthenticationRequestDelegate+exact:yes&sq=package:chromium) to get a [delegate object](https://cs.chromium.org/search/?q=symbol:AuthenticatorRequestClientDelegate+exact:yes) 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`](https://cs.chromium.org/search/?q=symbol:GetAssertionRequestHandler+exact:yes) from this directory.
20
21The `Handler` classes manage a specific user action and their first job is to [initiate discovery](https://cs.chromium.org/search/?q=symbol:FidoRequestHandlerBase::InitDiscoveries+exact:yes) of possible security keys. The discovery process will find candidate USB, BLE, Touch ID, etc devices, each of which will be fed into [`DispatchRequest`](https://cs.chromium.org/search/?q=symbol:GetAssertionRequestHandler::DispatchRequest+exact:yes). 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`](https://cs.chromium.org/search/?q=symbol:FidoAuthenticator+exact:yes) interface.
22
23If a per-authenticator operation is complex and requires several steps it will be handled by a “task”. In this example, a [`GetAssertionTask`](https://cs.chromium.org/search/?q=symbol:device::GetAssertionTask+exact:yes) will likely be created by a [`FidoDeviceAuthenticator`](https://cs.chromium.org/search/?q=symbol:device::FidoDeviceAuthenticator+exact:yes), the implementation of `FidoAuthenticator` used by physical devices.
24
25The 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`](https://cs.chromium.org/search/?q=symbol:device::U2FSignOperation+exact:yes) because U2F has a historical authenticator model.
26
27If interaction with UI is required, for example to prompt for a PIN, the handler will make calls via the [`Observer`](https://cs.chromium.org/search/?q=symbol:device::FidoRequestHandlerBase::Observer+exact:yes) interface, which is implemented by the embedder's UI objects that were created by `AuthenticatorCommon`.
28
29## Settings
30
31It'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`](https://cs.chromium.org/search/?q=symbol:settings::SecurityKeysHandler+exact:yes), which then operates in the same way as `AuthenticatorCommon`, albeit without creating any native UI.
32
33## Fuzzers
34
35[libFuzzer] tests are in `*_fuzzer.cc` files. They test for bad input from
36devices, e.g. when parsing responses to register or sign operations.
37
38[libFuzzer]: /testing/libfuzzer/README.md
39