• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 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//     http://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 = "UkeyProto";
22
23message Ukey2Message {
24  enum Type {
25    UNKNOWN_DO_NOT_USE = 0;
26    ALERT = 1;
27    CLIENT_INIT = 2;
28    SERVER_INIT = 3;
29    CLIENT_FINISH = 4;
30  }
31
32  optional Type message_type = 1;   // Identifies message type
33  optional bytes message_data = 2;  // Actual message, to be parsed according to
34  // message_type
35}
36
37message Ukey2Alert {
38  enum AlertType {
39    // Framing errors
40    BAD_MESSAGE = 1;        // The message could not be deserialized
41    BAD_MESSAGE_TYPE = 2;   // message_type has an undefined value
42    INCORRECT_MESSAGE = 3;  // message_type received does not correspond to
43    // expected type at this stage of the protocol
44    BAD_MESSAGE_DATA = 4;   // Could not deserialize message_data as per
45    //  value inmessage_type
46
47    // ClientInit and ServerInit errors
48    BAD_VERSION = 100;           // version is invalid; server cannot find
49    // suitable version to speak with client.
50    BAD_RANDOM = 101;            // Random data is missing or of incorrect
51    // length
52    BAD_HANDSHAKE_CIPHER = 102;  // No suitable handshake ciphers were found
53    BAD_NEXT_PROTOCOL = 103;     // The next protocol is missing, unknown, or
54    // unsupported
55    BAD_PUBLIC_KEY = 104;        // The public key could not be parsed
56
57    // Other errors
58    INTERNAL_ERROR = 200;  // An internal error has occurred. error_message
59    // may contain additional details for logging
60    // and debugging.
61  }
62
63  optional AlertType type = 1;
64  optional string error_message = 2;
65}
66
67enum Ukey2HandshakeCipher {
68  RESERVED = 0;
69  P256_SHA512 = 100;        // NIST P-256 used for ECDH, SHA512 used for
70  // commitment
71  CURVE25519_SHA512 = 200;  // Curve 25519 used for ECDH, SHA512 used for
72  // commitment
73}
74
75message Ukey2ClientInit {
76  optional int32 version = 1;  // highest supported version for rollback
77  // protection
78  optional bytes random = 2;   // random bytes for replay/reuse protection
79
80  // One commitment (hash of ClientFinished containing public key) per supported
81  // cipher
82  message CipherCommitment {
83    optional Ukey2HandshakeCipher handshake_cipher = 1;
84    optional bytes commitment = 2;
85  }
86  repeated CipherCommitment cipher_commitments = 3;
87
88  // Next protocol that the client wants to speak.
89  optional string next_protocol = 4;
90  // Next protocols the client can speak.
91  repeated string next_protocols = 5;
92}
93
94message Ukey2ServerInit {
95  optional int32 version = 1;  // highest supported version for rollback
96  // protection
97  optional bytes random = 2;   // random bytes for replay/reuse protection
98
99  // Selected Cipher and corresponding public key
100  optional Ukey2HandshakeCipher handshake_cipher = 3;
101  optional bytes public_key = 4;
102  // The server-selected next_protocol string based on the Ukey2ClientInit's
103  // next_protocol string and other_next_protocols array.
104  optional string selected_next_protocol = 5;
105}
106
107message Ukey2ClientFinished {
108  optional bytes public_key = 1;  // public key matching selected handshake
109  // cipher
110}
111