-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathagent_rpc.proto
More file actions
288 lines (248 loc) · 7.85 KB
/
agent_rpc.proto
File metadata and controls
288 lines (248 loc) · 7.85 KB
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
// SPDX-FileCopyrightText: © 2024-2025 Phala Network <dstack@phala.network>
//
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
import "google/protobuf/empty.proto";
package dstack_guest;
// For backwards compatibility with tappd
service Tappd {
// Derives a cryptographic key from the specified key path.
// Returns the derived key along with its certificate chain.
rpc DeriveKey(DeriveKeyArgs) returns (GetTlsKeyResponse) {}
// Derives a new ECDSA key with k256 EC curve.
rpc DeriveK256Key(GetKeyArgs) returns (DeriveK256KeyResponse) {}
// Generates a TDX quote
rpc TdxQuote(TdxQuoteArgs) returns (TdxQuoteResponse) {}
// Generates a TDX quote with raw report data.
// This is a low-level API that should be used with caution.
// When using quotes in multiple locations within your application,
// ensure proper quote differentiation by including a content type
// identifier in the report_data to avoid Quote Repurposing Attacks.
rpc RawQuote(RawQuoteArgs) returns (TdxQuoteResponse) {}
// Get app info
rpc Info(google.protobuf.Empty) returns (AppInfo) {}
// Get the guest agent version
rpc Version(google.protobuf.Empty) returns (WorkerVersion) {}
}
// The service for the dstack guest agent
service DstackGuest {
// Derives a cryptographic key from the specified key path.
// Returns the derived key along with its TLS certificate chain.
rpc GetTlsKey(GetTlsKeyArgs) returns (GetTlsKeyResponse) {}
// Derives a new key.
rpc GetKey(GetKeyArgs) returns (GetKeyResponse) {}
// Generates a TDX quote with given report data.
rpc GetQuote(RawQuoteArgs) returns (GetQuoteResponse) {}
// Generates a versioned attestation with the given report data.
// Returns a dstack-defined attestation format that supports different attestation modes across platforms.
rpc Attest(RawQuoteArgs) returns (AttestResponse) {}
// Emit an event. This extends the event to RTMR3 on TDX platform.
rpc EmitEvent(EmitEventArgs) returns (google.protobuf.Empty) {}
// Get app info
rpc Info(google.protobuf.Empty) returns (AppInfo) {}
// Sign a payload
rpc Sign(SignRequest) returns (SignResponse) {}
// Verify a signature
rpc Verify(VerifyRequest) returns (VerifyResponse) {}
// Get the guest agent version
rpc Version(google.protobuf.Empty) returns (WorkerVersion) {}
}
// The request to derive a key
message GetTlsKeyArgs {
// Subject of the certificate to request
string subject = 1;
// DNS alternative names for the certificate
repeated string alt_names = 2;
// Includes quote in the certificate
bool usage_ra_tls = 3;
// Key usage server auth
bool usage_server_auth = 4;
// Key usage client auth
bool usage_client_auth = 5;
// Certificate validity start time as seconds since UNIX epoch
optional uint64 not_before = 6;
// Certificate validity end time as seconds since UNIX epoch
optional uint64 not_after = 7;
// Includes app info in the certificate
bool with_app_info = 8;
}
// The request to derive a key
message DeriveKeyArgs {
// Path used to derive the private key
string path = 1;
// Bellow fields are used to generate the certificate
// Subject of the certificate to request
string subject = 2;
// DNS alternative names for the certificate
repeated string alt_names = 3;
// Includes quote in the certificate
bool usage_ra_tls = 4;
// Key usage server auth
bool usage_server_auth = 5;
// Key usage client auth
bool usage_client_auth = 6;
// Derive from random seed
bool random_seed = 7;
}
// The response to a DeriveKey request
message GetTlsKeyResponse {
// Derived key
string key = 1;
// Certificate chain
repeated string certificate_chain = 2;
}
// The request to derive a new key
message GetKeyArgs {
// Path to the key to derive
string path = 1;
// Purpose of the key
string purpose = 2;
// Algorithm of the key. Either `secp256k1` or `ed25519`. Defaults to `secp256k1`
string algorithm = 3;
}
// The response to a DeriveK256Key request
message DeriveK256KeyResponse {
// Derived k256 key
bytes k256_key = 1;
// Derived k256 signature chain
repeated bytes k256_signature_chain = 2;
}
// The response to a GetEthKey request
message GetKeyResponse {
// Derived key
bytes key = 1;
// The signature chain consists of the following signatures:
// [0] - the k256 signature of the derived pK signed by the app root key
// [1] - the k256 signature of the app root pK signed by the KMS root key
repeated bytes signature_chain = 2;
}
// The request to get a TDX quote
// The report data is prefixed with `app-data:` before hashing unless the algorithm is `raw`.
// Final report data is hash(`app-data:` + report_data) if the algorithm is not `raw`.
message TdxQuoteArgs {
// Report data
bytes report_data = 1;
// The hash algorithm to use to process the report data. Default is `sha512`.
// Supported algorithms are:
// - `sha256`
// - `sha384`
// - `sha512`
// - `sha3-256`
// - `sha3-384`
// - `sha3-512`
// - `keccak256`
// - `keccak384`
// - `keccak512`
// - `raw`: Passes the report_data directly to the driver without any processing
string hash_algorithm = 2;
// Custom prefix to prepend to report data before hashing.
// Defaults to 'app-data:' when hash_algorithm is not 'raw'.
string prefix = 3;
}
// The request to get a raw TDX quote
message RawQuoteArgs {
// 64 bytes of report data
bytes report_data = 1;
}
message TdxQuoteResponse {
// TDX quote
bytes quote = 1;
// Event log
string event_log = 2;
// The following fields might be used for app debugging purposes
// Hash algorithm used to hash the caller passed in report data
string hash_algorithm = 3;
// Prefix added to the report data before hashing
string prefix = 4;
}
message AttestResponse {
// The attestation
bytes attestation = 1;
}
message GetQuoteResponse {
// TDX quote
bytes quote = 1;
// Event log
string event_log = 2;
// Report data
bytes report_data = 3;
// Hw config
string vm_config = 4;
}
message EmitEventArgs {
// The event name
string event = 1;
// The event data
bytes payload = 2;
}
// The request to derive a key
message AppInfo {
// App ID
bytes app_id = 1;
// App Instance ID
bytes instance_id = 2;
// App certificate
string app_cert = 3;
// TCB info
string tcb_info = 4;
// App name
string app_name = 5;
// Device ID
bytes device_id = 8;
// MR Aggregated
bytes mr_aggregated = 9;
// OS Image hash
bytes os_image_hash = 10;
// Key provider info
string key_provider_info = 12;
// Compose hash
bytes compose_hash = 13;
// VM config
string vm_config = 14;
// Cloud provider sys_vendor (e.g. "Google")
string cloud_vendor = 15;
// Cloud provider product_name (e.g. "Google Compute Engine")
string cloud_product = 16;
}
// The response to a Version request
message WorkerVersion {
// dstack version
string version = 1;
// Git revision
string rev = 2;
}
service Worker {
// Get app info
rpc Info(google.protobuf.Empty) returns (AppInfo) {}
// Get the guest agent version
rpc Version(google.protobuf.Empty) returns (WorkerVersion) {}
// Get attestation
rpc GetAttestationForAppKey(GetAttestationForAppKeyRequest) returns (GetQuoteResponse) {}
}
message SignRequest {
string algorithm = 1;
bytes data = 2;
}
message SignResponse {
// the signature of the data
bytes signature = 1;
// The signature chain consists of the following signatures:
// [0] - the signature of the data
// [1] - the k256 signature of the message signing pubkey signed by the app root key
// [2] - the k256 signature of the app root pubkey signed by the KMS root key
repeated bytes signature_chain = 2;
// The public key signing the data
bytes public_key = 3;
}
message VerifyRequest {
string algorithm = 1;
bytes data = 2;
bytes signature = 3;
bytes public_key = 4;
}
message VerifyResponse {
bool valid = 1;
}
message GetAttestationForAppKeyRequest {
string algorithm = 1;
}