• 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 = "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}
91
92message Ukey2ServerInit {
93  optional int32 version = 1;  // highest supported version for rollback
94                               // protection
95  optional bytes random = 2;   // random bytes for replay/reuse protection
96
97  // Selected Cipher and corresponding public key
98  optional Ukey2HandshakeCipher handshake_cipher = 3;
99  optional bytes public_key = 4;
100}
101
102message Ukey2ClientFinished {
103  optional bytes public_key = 1;  // public key matching selected handshake
104                                  // cipher
105}
106