• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto2";
16
17package securegcm;
18
19option optimize_for = LITE_RUNTIME;
20option java_package = "com.google.security.cryptauth.lib.securegcm";
21option java_outer_classname = "SecureGcmProto";
22option objc_class_prefix = "SGCM";
23
24// Message used only during enrollment
25// Field numbers should be kept in sync with DeviceInfo in:
26//   java/com/google/security/cryptauth/backend/services/common/common.proto
27message GcmDeviceInfo {
28  // This field's name does not match the one in DeviceInfo for legacy reasons.
29  // Consider using long_device_id and device_type instead when enrolling
30  // non-android devices.
31  optional fixed64 android_device_id = 1;
32
33  // Used for device_address of DeviceInfo field 2, but for GCM capable devices.
34  optional bytes gcm_registration_id = 102;
35
36  // Used for device_address of DeviceInfo field 2, but for iOS devices.
37  optional bytes apn_registration_id = 202;
38
39  // Does the user have notifications enabled for the given device address.
40  optional bool notification_enabled = 203 [default = true];
41
42  // Used for device_address of DeviceInfo field 2, a Bluetooth Mac address for
43  // the device (e.g., to be used with EasyUnlock)
44  optional string bluetooth_mac_address = 302;
45
46  // SHA-256 hash of the device master key (from the key exchange).
47  // Differs from DeviceInfo field 3, which contains the actual master key.
48  optional bytes device_master_key_hash = 103;
49
50  // A SecureMessage.EcP256PublicKey
51  required bytes user_public_key = 4;
52
53  // device's model name
54  // (e.g., an android.os.Build.MODEL or UIDevice.model)
55  optional string device_model = 7;
56
57  // device's locale
58  optional string locale = 8;
59
60  // The handle for user_public_key (and implicitly, a master key)
61  optional bytes key_handle = 9;
62
63  // The initial counter value for the device, sent by the device
64  optional int64 counter = 12 [default = 0];
65
66  // The Operating System version on the device
67  // (e.g., an android.os.Build.DISPLAY or UIDevice.systemVersion)
68  optional string device_os_version = 13;
69
70  // The Operating System version number on the device
71  // (e.g., an android.os.Build.VERSION.SDK_INT)
72  optional int64 device_os_version_code = 14;
73
74  // The Operating System release on the device
75  // (e.g., an android.os.Build.VERSION.RELEASE)
76  optional string device_os_release = 15;
77
78  // The Operating System codename on the device
79  // (e.g., an android.os.Build.VERSION.CODENAME or UIDevice.systemName)
80  optional string device_os_codename = 16;
81
82  // The software version running on the device
83  // (e.g., Authenticator app version string)
84  optional string device_software_version = 17;
85
86  // The software version number running on the device
87  // (e.g., Authenticator app version code)
88  optional int64 device_software_version_code = 18;
89
90  // Software package information if applicable
91  // (e.g., com.google.android.apps.authenticator2)
92  optional string device_software_package = 19;
93
94  // Size of the display in thousandths of an inch (e.g., 7000 mils = 7 in)
95  optional int32 device_display_diagonal_mils = 22;
96
97  // For Authzen capable devices, their Authzen protocol version
98  optional int32 device_authzen_version = 24;
99
100  // Not all devices have device identifiers that fit in 64 bits.
101  optional bytes long_device_id = 29;
102
103  // The device manufacturer name
104  // (e.g., android.os.Build.MANUFACTURER)
105  optional string device_manufacturer = 31;
106
107  // Used to indicate which type of device this is.
108  optional DeviceType device_type = 32 [default = ANDROID];
109
110  // Fields corresponding to screenlock type/features and hardware features
111  // should be numbered in the 400 range.
112
113  // Is this device using  a secure screenlock (e.g., pattern or pin unlock)
114  optional bool using_secure_screenlock = 400 [default = false];
115
116  // Is auto-unlocking the screenlock (e.g., when at "home") supported?
117  optional bool auto_unlock_screenlock_supported = 401 [default = false];
118
119  // Is auto-unlocking the screenlock (e.g., when at "home") enabled?
120  optional bool auto_unlock_screenlock_enabled = 402 [default = false];
121
122  // Does the device have a Bluetooth (classic) radio?
123  optional bool bluetooth_radio_supported = 403 [default = false];
124
125  // Is the Bluetooth (classic) radio on?
126  optional bool bluetooth_radio_enabled = 404 [default = false];
127
128  // Does the device hardware support a mobile data connection?
129  optional bool mobile_data_supported = 405 [default = false];
130
131  // Does the device support tethering?
132  optional bool tethering_supported = 406 [default = false];
133
134  // Does the device have a BLE radio?
135  optional bool ble_radio_supported = 407 [default = false];
136
137  // Is the device a "Pixel Experience" Android device?
138  optional bool pixel_experience = 408 [default = false];
139
140  // Is the device running in the ARC++ container on a chromebook?
141  optional bool arc_plus_plus = 409 [default = false];
142
143  // Is the value set in |using_secure_screenlock| reliable? On some Android
144  // devices, the platform API to get the screenlock state is not trustworthy.
145  // See b/32212161.
146  optional bool is_screenlock_state_flaky = 410 [default = false];
147
148  // A list of multi-device software features supported by the device.
149  repeated SoftwareFeature supported_software_features = 411;
150
151  // A list of multi-device software features currently enabled (active) on the
152  // device.
153  repeated SoftwareFeature enabled_software_features = 412;
154
155  // The enrollment session id this is sent with
156  optional bytes enrollment_session_id = 1000;
157
158  // A copy of the user's OAuth token
159  optional string oauth_token = 1001;
160}
161
162// This enum is used by iOS devices as values for device_display_diagonal_mils
163// in GcmDeviceInfo. There is no good way to calculate it on those devices.
164enum AppleDeviceDiagonalMils {
165  // This is the mils diagonal on an iPhone 5.
166  APPLE_PHONE = 4000;
167  // This is the mils diagonal on an iPad mini.
168  APPLE_PAD = 7900;
169}
170
171// This should be kept in sync with DeviceType in:
172// java/com/google/security/cryptauth/backend/services/common/common_enums.proto
173enum DeviceType {
174  UNKNOWN = 0;
175  ANDROID = 1;
176  CHROME = 2;
177  IOS = 3;
178  BROWSER = 4;
179  OSX = 5;
180}
181
182// MultiDevice features which may be supported and enabled on a device. See
183enum SoftwareFeature {
184  UNKNOWN_FEATURE = 0;
185  BETTER_TOGETHER_HOST = 1;
186  BETTER_TOGETHER_CLIENT = 2;
187  EASY_UNLOCK_HOST = 3;
188  EASY_UNLOCK_CLIENT = 4;
189  MAGIC_TETHER_HOST = 5;
190  MAGIC_TETHER_CLIENT = 6;
191  SMS_CONNECT_HOST = 7;
192  SMS_CONNECT_CLIENT = 8;
193}
194
195// A list of "reasons" that can be provided for calling server-side APIs.
196// This is particularly important for calls that can be triggered by different
197// kinds of events. Please try to keep reasons as generic as possible, so that
198// codes can be re-used by various callers in a sensible fashion.
199enum InvocationReason {
200  REASON_UNKNOWN = 0;
201  // First run of the software package invoking this call
202  REASON_INITIALIZATION = 1;
203  // Ordinary periodic actions (e.g. monthly master key rotation)
204  REASON_PERIODIC = 2;
205  // Slow-cycle periodic action (e.g. yearly keypair rotation???)
206  REASON_SLOW_PERIODIC = 3;
207  // Fast-cycle periodic action (e.g. daily sync for Smart Lock users)
208  REASON_FAST_PERIODIC = 4;
209  // Expired state (e.g. expired credentials, or cached entries) was detected
210  REASON_EXPIRATION = 5;
211  // An unexpected protocol failure occurred (so attempting to repair state)
212  REASON_FAILURE_RECOVERY = 6;
213  // A new account has been added to the device
214  REASON_NEW_ACCOUNT = 7;
215  // An existing account on the device has been changed
216  REASON_CHANGED_ACCOUNT = 8;
217  // The user toggled the state of a feature (e.g. Smart Lock enabled via BT)
218  REASON_FEATURE_TOGGLED = 9;
219  // A "push" from the server caused this action (e.g. a sync tickle)
220  REASON_SERVER_INITIATED = 10;
221  // A local address change triggered this (e.g. GCM registration id changed)
222  REASON_ADDRESS_CHANGE = 11;
223  // A software update has triggered this
224  REASON_SOFTWARE_UPDATE = 12;
225  // A manual action by the user triggered this (e.g. commands sent via adb)
226  REASON_MANUAL = 13;
227  // A custom key has been invalidated on the device (e.g. screen lock is
228  // disabled).
229  REASON_CUSTOM_KEY_INVALIDATION = 14;
230  // Periodic action triggered by auth_proximity
231  REASON_PROXIMITY_PERIODIC = 15;
232}
233
234enum Type {
235  ENROLLMENT = 0;
236  TICKLE = 1;
237  TX_REQUEST = 2;
238  TX_REPLY = 3;
239  TX_SYNC_REQUEST = 4;
240  TX_SYNC_RESPONSE = 5;
241  TX_PING = 6;
242  DEVICE_INFO_UPDATE = 7;
243  TX_CANCEL_REQUEST = 8;
244
245  // DEPRECATED (can be re-used after Aug 2015)
246  PROXIMITYAUTH_PAIRING = 10;
247
248  // The kind of identity assertion generated by a "GCM V1" device (i.e.,
249  // an Android phone that has registered with us a public and a symmetric
250  // key)
251  GCMV1_IDENTITY_ASSERTION = 11;
252
253  // Device-to-device communications are protected by an unauthenticated
254  // Diffie-Hellman exchange. The InitiatorHello message is simply the
255  // initiator's public DH key, and is not encoded as a SecureMessage, so
256  // it doesn't have a tag.
257  // The ResponderHello message (which is sent by the responder
258  // to the initiator), on the other hand, carries a payload that is protected
259  // by the derived shared key. It also contains the responder's
260  // public DH key. ResponderHelloAndPayload messages have the
261  // DEVICE_TO_DEVICE_RESPONDER_HELLO tag.
262  DEVICE_TO_DEVICE_RESPONDER_HELLO_PAYLOAD = 12;
263
264  // Device-to-device communications are protected by an unauthenticated
265  // Diffie-Hellman exchange. Once the initiator and responder
266  // agree on a shared key (through Diffie-Hellman), they will use messages
267  // tagged with DEVICE_TO_DEVICE_MESSAGE to exchange data.
268  DEVICE_TO_DEVICE_MESSAGE = 13;
269
270  // Notification to let a device know it should contact a nearby device.
271  DEVICE_PROXIMITY_CALLBACK = 14;
272
273  // Device-to-device communications are protected by an unauthenticated
274  // Diffie-Hellman exchange. During device-to-device authentication, the first
275  // message from initiator (the challenge) is signed and put into the payload
276  // of the message sent back to the initiator.
277  UNLOCK_KEY_SIGNED_CHALLENGE = 15;
278
279  // Specialty (corp only) features
280  LOGIN_NOTIFICATION = 101;
281}
282
283message GcmMetadata {
284  required Type type = 1;
285  optional int32 version = 2 [default = 0];
286}
287
288message Tickle {
289  // Time after which this tickle should expire
290  optional fixed64 expiry_time = 1;
291}
292
293message LoginNotificationInfo {
294  // Time at which the server received the login notification request.
295  optional fixed64 creation_time = 2;
296
297  // Must correspond to user_id in LoginNotificationRequest, if set.
298  optional string email = 3;
299
300  // Host where the user's credentials were used to login, if meaningful.
301  optional string host = 4;
302
303  // Location from where the user's credentials were used, if meaningful.
304  optional string source = 5;
305
306  // Type of login, e.g. ssh, gnome-screensaver, or web.
307  optional string event_type = 6;
308}
309