File: auth_factor.proto

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (373 lines) | stat: -rw-r--r-- 14,675 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Provides wire-type for cryptohome Key objects.  It does not
// represent the entirety of the bookkeeping data needed by Cryptohome.
//
// Anything in this file may be persisted on disk.  Update carefully!

syntax = "proto3";

option optimize_for = LITE_RUNTIME;

package user_data_auth;
option go_package = "go.chromium.org/chromiumos/system_api/user_data_auth_proto";

import "recoverable_key_store.proto";

// Enum to define all the available types of AuthFactor. This would be used for
// identification of a given AuthFactor.
enum AuthFactorType {
  AUTH_FACTOR_TYPE_UNSPECIFIED = 0;
  AUTH_FACTOR_TYPE_PASSWORD = 1;
  AUTH_FACTOR_TYPE_PIN = 2;
  AUTH_FACTOR_TYPE_CRYPTOHOME_RECOVERY = 3;
  AUTH_FACTOR_TYPE_KIOSK = 4;
  AUTH_FACTOR_TYPE_SMART_CARD = 5;
  AUTH_FACTOR_TYPE_LEGACY_FINGERPRINT = 6;
  AUTH_FACTOR_TYPE_FINGERPRINT = 7;
}

// Enum to define the purpose of AuthFactor preparation. This would be used
// in PrepareAsyncAuthFactorRequest.
enum AuthFactorPreparePurpose {
  PURPOSE_UNSPECIFIED = 0;
  // For adding a new auth factor. Usually it indicates PrepareAsynAuthFactor()
  // runs an auth factor enrollment process (based on user input collection).
  PURPOSE_ADD_AUTH_FACTOR = 1;
  // For authenticating an existing async auth factor. Usually this indicates
  // PrepareAsyncAuthFactor() runs an user input collection process.
  PURPOSE_AUTHENTICATE_AUTH_FACTOR = 2;
}

// Cryptographic signature algorithm type for smart card requests. Used with
// SmartCardAuthInput.
enum SmartCardSignatureAlgorithm {
  CHALLENGE_NOT_SPECIFIED = 0;
  CHALLENGE_RSASSA_PKCS1_V1_5_SHA1 = 1;
  CHALLENGE_RSASSA_PKCS1_V1_5_SHA256 = 2;
  CHALLENGE_RSASSA_PKCS1_V1_5_SHA384 = 3;
  CHALLENGE_RSASSA_PKCS1_V1_5_SHA512 = 4;
}

// Request data for challenge requests of the |CHALLENGE_TYPE_SIGNATURE| request
// type.
message SignatureKeyChallengeRequestData {
  // The blob of data for which the signature is asked.
  bytes data_to_sign = 1;
  // Specifies the key which is asked to sign the data. Contains the DER-encoded
  // blob of the X.509 Subject Public Key Info.
  bytes public_key_spki_der = 2;
  // Specifies the signature algorithm that has to be used.
  SmartCardSignatureAlgorithm signature_algorithm = 3;
}

// An intent specifies the set of operations that can be performed after
// successfully authenticating an Auth Session.
enum AuthIntent {
  // Default value.
  AUTH_INTENT_UNSPECIFIED = 0;
  // Intent to decrypt the user's file system keys. Authorizing for this intent
  // allows all privileged operations, e.g., preparing user's vault,
  // adding/updating/removing factors.
  AUTH_INTENT_DECRYPT = 1;
  // Intent to simply check whether the authentication succeeds. Authorizing for
  // this intent doesn't allow any privileged operation.
  AUTH_INTENT_VERIFY_ONLY = 2;
  // Intent to specify the WebAuthn secret should be populated after authorizing
  // when applicable, i.e., when the AuthFactor type isn't kLegacyFingerprint.
  AUTH_INTENT_WEBAUTHN = 3;

  reserved 4, 5;
}

// Password AuthFactor requires a secret to be passed for derivation and
// creation of key.
message PasswordAuthInput {
  bytes secret = 1;
}

// Pin AuthFactor requires a secret to be passed for derivation and
// creation of key.
message PinAuthInput {
  bytes secret = 1;
}

message CryptohomeRecoveryAuthInput {
  // These fields are used for `AddAuthFactor`:
  // Public key of the mediator for Cryptohome recovery flow.
  bytes mediator_pub_key = 1;
  // Gaia_id of the user executing the recovery flow.
  string user_gaia_id = 2;
  // Unique id of the user's vault on the device.
  string device_user_id = 3;
  // Whether the recovery id should be rotated.
  optional bool ensure_fresh_recovery_id = 7;

  // These fields are used for `AuthenticateAuthFactor`:
  // Serialized cryptohome.cryptorecovery.CryptoRecoveryEpochResponse.
  // An epoch response received from Recovery Mediator service containing epoch
  // beacon value for Cryptohome recovery flow.
  bytes epoch_response = 4;
  // Serialized cryptohome.cryptorecovery.CryptoRecoveryRpcResponse.
  // A response received from Recovery Mediator service and used by Cryptohome
  // recovery flow to derive the wrapping keys.
  bytes recovery_response = 5;
  // The ledger info from the chrome side and used by Cryptohome
  // recovery flow to determine which ledger is used.
  message LedgerInfo {
    // Ledger's name.
    string name = 1;
    // Ledger's public key hash.
    // TODO(b/268054784): Remove this field if hash can be calculated.
    uint32 key_hash = 2;
    // Ledger's public key.
    bytes public_key = 3;
  }
  LedgerInfo ledger_info = 6;
}

// Kiosk AuthFactor requires no secret to be passed for derivation and
// creation of key.
message KioskAuthInput {}

// Smartcard AuthFactor requires no secret to be passed for derivation
// and creation of key.
message SmartCardAuthInput {
  // Specifies the signature algorithms that are supported by an individual
  // smart card.
  repeated SmartCardSignatureAlgorithm signature_algorithms = 1;
  // Parameters for connecting and making requests to a key delegate service:
  // |dbus_service_name|, the D-Bus service name of the key delegate service
  // that exports the key delegate object.
  string key_delegate_dbus_service_name = 2;
}

// LegacyFingerprintAuthInput serves as an auth factor type indicator in
// AuthenticateAuthFactorRequest.
message LegacyFingerprintAuthInput {}

// FingerprintAuthInput is empty. FingerprintAuthFactor does not require
// user input any secret.
message FingerprintAuthInput {}

// AuthInput is a wrapper around any secret or input data that is required to
// authenticate or create an AuthFactor on disk.
message AuthInput {
  // An AuthFactor could also carry with itself some input in some cases,
  // such as password, the secret would be user supplied. In those cases the
  // secret can be passed here.
  oneof input {
    PasswordAuthInput password_input = 1;
    PinAuthInput pin_input = 2;
    CryptohomeRecoveryAuthInput cryptohome_recovery_input = 3;
    KioskAuthInput kiosk_input = 4;
    SmartCardAuthInput smart_card_input = 5;
    LegacyFingerprintAuthInput legacy_fingerprint_input = 6;
    FingerprintAuthInput fingerprint_input = 7;
  }
}

// Recovery requires input to generate the initial request to be sent to the
// recovery server.
message CryptohomeRecoveryPrepareInput {
  // Label to identify the existing cryptohome recovery AuthFactor.
  string auth_factor_label = 2;
  // The type of user being requested.
  enum UserType {
    UNKNOWN = 0;
    GAIA_ID = 1;
  }
  UserType requestor_user_id_type = 3;
  // Format of `requestor_user_id` is determined by `requestor_user_id_type`
  // enum. For GAIA_ID it's number string obfuscated Gaia id.
  string requestor_user_id = 4;
  // Access token with reauth scope.
  string gaia_access_token = 5;
  // A short-lived token, it's validity will be verified by the Recovery
  // Service.
  string gaia_reauth_proof_token = 6;
  // Serialized cryptohome.cryptorecovery.CryptoRecoveryEpochResponse.
  // An epoch response received from Recovery Mediator service containing epoch
  // beacon value for Cryptohome recovery flow.
  bytes epoch_response = 7;

  reserved 1;
}

// Smartcard input specifies the algorithm.
message SmartCardPrepareInput {
  // Specifies the signature algorithms that are supported by an individual
  // smart card.
  repeated SmartCardSignatureAlgorithm signature_algorithms = 1;
}

// Smartcard input specifies the algorithm.
message SmartCardPrepareOutput {  // Specifies challenge types.
  enum ChallengeType {
    CHALLENGE_TYPE_UNSPECIFIED = 0;
    // Challenge is a request of a cryptographic signature of the specified data
    // using the specified key.
    CHALLENGE_TYPE_SIGNATURE = 1;
  }
  // Type of the requested challenge.
  optional ChallengeType challenge_type = 1;
  // Is set when |challenge_type| is |CHALLENGE_TYPE_SIGNATURE|. Contains the
  // challenge request data.
  optional SignatureKeyChallengeRequestData signature_request_data = 2;
  // If more_challenges_remaining is set to true, then the caller needs to
  // call PrepareAuthFactor again to complete the prepare request.
  // The challenge passed in this can still be continued to process.
  optional bool more_challenges_remaining = 3;
}

// PrepareInput is a wrapper around any secret or input data that is required to
// prepare for authentication with a factor.
message PrepareInput {
  oneof input {
    CryptohomeRecoveryPrepareInput cryptohome_recovery_input = 1;
    SmartCardPrepareInput smart_card_input = 2;
  }
}

// Recovery requires input to generate the initial request to be sent to the
// recovery server.
message CryptohomeRecoveryPrepareOutput {
  // Serialized cryptohome.cryptorecovery.CryptoRecoveryRpcRequest, to be sent
  // to the recovery server.
  bytes recovery_request = 1;
}

// PrepareOutput is a wrapper around any output data produced by the preparation
// process.
message PrepareOutput {
  oneof output {
    CryptohomeRecoveryPrepareOutput cryptohome_recovery_output = 1;
    SmartCardPrepareOutput smart_card_output = 2;
  }
}

message PasswordMetadata {
  // The hash information used to generate the secret.
  KnowledgeFactorHashInfo hash_info = 1;
}

message PinMetadata {
  // The hash information used to generate the secret.
  KnowledgeFactorHashInfo hash_info = 2;

  reserved 1;
}

message CryptohomeRecoveryMetadata {
  // Public key of the mediator for Cryptohome recovery flow.
  bytes mediator_pub_key = 1;
}

message KioskMetadata {}

message SmartCardMetadata {
  // Specifies the key which is asked to sign the data. Contains the DER-encoded
  // blob of the X.509 Subject Public Key Info.
  // This is supplied by client, updated through Add/Update requests.
  bytes public_key_spki_der = 1;
}

enum LockoutPolicy {
  // Default value.
  LOCKOUT_POLICY_UNKNOWN = 0;
  // Ideally this will be default, but should be explicitly set for an
  // AuthFactor where multiple attempts are allowed without any repercussions.
  LOCKOUT_POLICY_NONE = 1;
  // ATTEMPT_LIMITED is for an AuthFactors that is not available for a
  // user x number of wrong attempts. For example, for PIN we lockout
  // user from PIN usage after five attempts.
  LOCKOUT_POLICY_ATTEMPT_LIMITED = 2;
  // TIME_LIMITED is when we locked out user from using a certain AuthFactor
  // for a particular time after particular number of wrong attempts.
  // The policy specifics itself can be custom defined by an AuthFactor.
  LOCKOUT_POLICY_TIME_LIMITED = 3;
}

// The hash information of an auth factor that is used to generate the actual
// secret. This can be used to generate the recoverable key store for the auth
// factor.
message KnowledgeFactorHashInfo {
  cryptohome.KnowledgeFactorHashAlgorithm algorithm = 1;
  bytes salt = 2;
  // Some auth factors explicitly don't want to generate recoverable key stores
  // even if they are knowledge factors with hash info. Use this flag to
  // determine whether key stores should be generated using this hash info.
  bool should_generate_key_store = 3;
}

message CommonMetadata {
  // Specifies the version AuthFactor was last updated.
  // The version number is read from CHROMEOS_RELEASE_VERSION field in
  // /etc/lsb-release whenever AuthFactor is updated or first persisted.
  // See:https://chromium.googlesource.com/chromiumos/docs/+/HEAD/os_config.md
  // For example: "11012.0.2018_08_28_1422" could be returned as part of this.
  // This is populated by cryptohome,  should be omitted in any Add/Update
  // request. And it will be ignored when present in any Add/Update request.
  string chromeos_version_last_updated = 1;
  // This version number will be supplied by chrome when it calls AddAuthFactor
  // or UpdateAuthFactor.
  // Note: The format of this version will be maintained by chrome.
  // This is supplied by client, updated through Add/Update requests.
  string chrome_version_last_updated = 2;
  // This defines how lockout work for each factor. The non-default value is
  // currently set only for PIN AuthFactor. For pins, if the feature
  // CrosLateBCrOSLateBootEnableModernPin is enabled, then AddAuthFactor for PIN
  // will expect LockoutPolicy::LOCKOUT_POLICY_TIME_LIMITED, else
  // LockoutPolicy::LOCKOUT_POLICY_ATTEMPT_LIMITED. If anything else is provided
  // then AuthFactor would return CRYPTOHOME_INVALID_ARGUMENT error.
  // This is supplied by client, updated through Add/Update requests.
  LockoutPolicy lockout_policy = 3;
  // User supplied name of each auth factor.
  // This is supplied by client, updated through Add/Update requests.
  string user_specified_name = 4;
}

message LegacyFingerprintMetadata {}

message FingerprintMetadata {
  // Set to true when migrated from a legacy fingerprint template.
  bool was_migrated = 1;
}

// AuthFactor is a backing store for any secret stored on Chrome OS in the USS
// World. This proto definition is used to communicate with the client side.
// Once it is received on cryptohome side, this proto definition is converted to
// a flatbuffer for usage and storage.
// A note: The intention is for client side to not know about the type of
// backing store. So when any AuthFactor API is called, it is cryptohome that
// decides what backing store would be used -- either VaultKeyset or AuthFactor.
// This decion making does not have any effect on how the client uses the API.
message AuthFactor {
  // AuthFactorType will help us determine the type and subsequently help us
  // create the right AuthBlock for derivation or authentication.
  AuthFactorType type = 1;
  // AuthFactor would be identified by its label which would be unique across
  // all the AuthFactors for a given user. The label must be a non-empty string,
  // only consisting of characters from the set {a-z, A-Z, 0-9, _, -}, and whose
  // length doesn't exceed 1000.
  string label = 2;
  // Common metadata that is shared across all types.
  CommonMetadata common_metadata = 9;

  // An AuthFactor could also carry with itself some metadata. Since an
  // AuthFactor could only be one type, oneof is used to define the usage of
  // metadata.
  oneof metadata {
    PasswordMetadata password_metadata = 4;
    PinMetadata pin_metadata = 5;
    CryptohomeRecoveryMetadata cryptohome_recovery_metadata = 6;
    KioskMetadata kiosk_metadata = 7;
    SmartCardMetadata smart_card_metadata = 8;
    LegacyFingerprintMetadata legacy_fingerprint_metadata = 11;
    FingerprintMetadata fingerprint_metadata = 12;
  }

  reserved 3, 10;
}