Debian Codegraph @

test/core/tsi/alts/fake_handshaker/handshaker.proto

raw
1 // Copyright 2018 gRPC authors.
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
15 syntax = "proto3";
16
17 import "test/core/tsi/alts/fake_handshaker/transport_security_common.proto";
18
19 package grpc.gcp;
20
21 option java_package = "io.grpc.alts.internal";
22
23 enum HandshakeProtocol {
24 // Default value.
25 HANDSHAKE_PROTOCOL_UNSPECIFIED = 0;
26
27 // TLS handshake protocol.
28 TLS = 1;
29
30 // Application Layer Transport Security handshake protocol.
31 ALTS = 2;
32 }
33
34 enum NetworkProtocol {
35 NETWORK_PROTOCOL_UNSPECIFIED = 0;
36 TCP = 1;
37 UDP = 2;
38 }
39
40 message Endpoint {
41 // IP address. It should contain an IPv4 or IPv6 string literal, e.g.
42 // "192.168.0.1" or "2001:db8::1".
43 string ip_address = 1;
44
45 // Port number.
46 int32 port = 2;
47
48 // Network protocol (e.g., TCP, UDP) associated with this endpoint.
49 NetworkProtocol protocol = 3;
50 }
51
52 message Identity {
53 oneof identity_oneof {
54 // Service account of a connection endpoint.
55 string service_account = 1;
56
57 // Hostname of a connection endpoint.
58 string hostname = 2;
59 }
60 }
61
62 message StartClientHandshakeReq {
63 // Handshake security protocol requested by the client.
64 HandshakeProtocol handshake_security_protocol = 1;
65
66 // The application protocols supported by the client, e.g., "h2" (for http2),
67 // "grpc".
68 repeated string application_protocols = 2;
69
70 // The record protocols supported by the client, e.g.,
71 // "ALTSRP_GCM_AES128".
72 repeated string record_protocols = 3;
73
74 // (Optional) Describes which server identities are acceptable by the client.
75 // If target identities are provided and none of them matches the peer
76 // identity of the server, handshake will fail.
77 repeated Identity target_identities = 4;
78
79 // (Optional) Application may specify a local identity. Otherwise, the
80 // handshaker chooses a default local identity.
81 Identity local_identity = 5;
82
83 // (Optional) Local endpoint information of the connection to the server,
84 // such as local IP address, port number, and network protocol.
85 Endpoint local_endpoint = 6;
86
87 // (Optional) Endpoint information of the remote server, such as IP address,
88 // port number, and network protocol.
89 Endpoint remote_endpoint = 7;
90
91 // (Optional) If target name is provided, a secure naming check is performed
92 // to verify that the peer authenticated identity is indeed authorized to run
93 // the target name.
94 string target_name = 8;
95
96 // (Optional) RPC protocol versions supported by the client.
97 RpcProtocolVersions rpc_versions = 9;
98
99 // (Optional) Maximum frame size supported by the client.
100 uint32 max_frame_size = 10;
101 }
102
103 message ServerHandshakeParameters {
104 // The record protocols supported by the server, e.g.,
105 // "ALTSRP_GCM_AES128".
106 repeated string record_protocols = 1;
107
108 // (Optional) A list of local identities supported by the server, if
109 // specified. Otherwise, the handshaker chooses a default local identity.
110 repeated Identity local_identities = 2;
111 }
112
113 message StartServerHandshakeReq {
114 // The application protocols supported by the server, e.g., "h2" (for http2),
115 // "grpc".
116 repeated string application_protocols = 1;
117
118 // Handshake parameters (record protocols and local identities supported by
119 // the server) mapped by the handshake protocol. Each handshake security
120 // protocol (e.g., TLS or ALTS) has its own set of record protocols and local
121 // identities. Since protobuf does not support enum as key to the map, the key
122 // to handshake_parameters is the integer value of HandshakeProtocol enum.
123 map<int32, ServerHandshakeParameters> handshake_parameters = 2;
124
125 // Bytes in out_frames returned from the peer's HandshakerResp. It is possible
126 // that the peer's out_frames are split into multiple HandshakReq messages.
127 bytes in_bytes = 3;
128
129 // (Optional) Local endpoint information of the connection to the client,
130 // such as local IP address, port number, and network protocol.
131 Endpoint local_endpoint = 4;
132
133 // (Optional) Endpoint information of the remote client, such as IP address,
134 // port number, and network protocol.
135 Endpoint remote_endpoint = 5;
136
137 // (Optional) RPC protocol versions supported by the server.
138 RpcProtocolVersions rpc_versions = 6;
139
140 // (Optional) Maximum frame size supported by the server.
141 uint32 max_frame_size = 7;
142 }
143
144 message NextHandshakeMessageReq {
145 // Bytes in out_frames returned from the peer's HandshakerResp. It is possible
146 // that the peer's out_frames are split into multiple NextHandshakerMessageReq
147 // messages.
148 bytes in_bytes = 1;
149 }
150
151 message HandshakerReq {
152 oneof req_oneof {
153 // The start client handshake request message.
154 StartClientHandshakeReq client_start = 1;
155
156 // The start server handshake request message.
157 StartServerHandshakeReq server_start = 2;
158
159 // The next handshake request message.
160 NextHandshakeMessageReq next = 3;
161 }
162 }
163
164 message HandshakerResult {
165 // The application protocol negotiated for this connection.
166 string application_protocol = 1;
167
168 // The record protocol negotiated for this connection.
169 string record_protocol = 2;
170
171 // Cryptographic key data. The key data may be more than the key length
172 // required for the record protocol, thus the client of the handshaker
173 // service needs to truncate the key data into the right key length.
174 bytes key_data = 3;
175
176 // The authenticated identity of the peer.
177 Identity peer_identity = 4;
178
179 // The local identity used in the handshake.
180 Identity local_identity = 5;
181
182 // Indicate whether the handshaker service client should keep the channel
183 // between the handshaker service open, e.g., in order to handle
184 // post-handshake messages in the future.
185 bool keep_channel_open = 6;
186
187 // The RPC protocol versions supported by the peer.
188 RpcProtocolVersions peer_rpc_versions = 7;
189
190 // The maximum frame size of the peer.
191 uint32 max_frame_size = 8;
192 }
193
194 message HandshakerStatus {
195 // The status code. This could be the gRPC status code.
196 uint32 code = 1;
197
198 // The status details.
199 string details = 2;
200 }
201
202 message HandshakerResp {
203 // Frames to be given to the peer for the NextHandshakeMessageReq. May be
204 // empty if no out_frames have to be sent to the peer or if in_bytes in the
205 // HandshakerReq are incomplete. All the non-empty out frames must be sent to
206 // the peer even if the handshaker status is not OK as these frames may
207 // contain the alert frames.
208 bytes out_frames = 1;
209
210 // Number of bytes in the in_bytes consumed by the handshaker. It is possible
211 // that part of in_bytes in HandshakerReq was unrelated to the handshake
212 // process.
213 uint32 bytes_consumed = 2;
214
215 // This is set iff the handshake was successful. out_frames may still be set
216 // to frames that needs to be forwarded to the peer.
217 HandshakerResult result = 3;
218
219 // Status of the handshaker.
220 HandshakerStatus status = 4;
221 }
222
223 service HandshakerService {
224 // Handshaker service accepts a stream of handshaker request, returning a
225 // stream of handshaker response. Client is expected to send exactly one
226 // message with either client_start or server_start followed by one or more
227 // messages with next. Each time client sends a request, the handshaker
228 // service expects to respond. Client does not have to wait for service's
229 // response before sending next request.
230 rpc DoHandshake(stream HandshakerReq)
231 returns (stream HandshakerResp) {
232 }
233 }