xref: /aosp_15_r20/external/pigweed/pw_software_update/tuf.proto (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker// Copyright 2021 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker//
3*61c4878aSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker// use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker// the License at
6*61c4878aSAndroid Build Coastguard Worker//
7*61c4878aSAndroid Build Coastguard Worker//     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker//
9*61c4878aSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker// License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker// the License.
14*61c4878aSAndroid Build Coastguard Worker//
15*61c4878aSAndroid Build Coastguard Worker// Implementation of metadata formats specified in TUF Specification.
16*61c4878aSAndroid Build Coastguard Worker// See https://theupdateframework.github.io/specification/latest/
17*61c4878aSAndroid Build Coastguard Worker
18*61c4878aSAndroid Build Coastguard Workersyntax = "proto3";
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard Workerpackage pw.software_update;
21*61c4878aSAndroid Build Coastguard Worker
22*61c4878aSAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto";
23*61c4878aSAndroid Build Coastguard Worker
24*61c4878aSAndroid Build Coastguard Worker// Metadata for a particular TUF role (e.g. targets metadata).
25*61c4878aSAndroid Build Coastguard Worker// Was TufMetadata
26*61c4878aSAndroid Build Coastguard Workermessage SignedRootMetadata {
27*61c4878aSAndroid Build Coastguard Worker  // Serialized RootMetadata message that is the data portion of the metadata.
28*61c4878aSAndroid Build Coastguard Worker  bytes serialized_root_metadata = 1;
29*61c4878aSAndroid Build Coastguard Worker
30*61c4878aSAndroid Build Coastguard Worker  // Signature of the canonical form of the role's serialized metadata
31*61c4878aSAndroid Build Coastguard Worker  // (serialized_root_metadata).
32*61c4878aSAndroid Build Coastguard Worker  repeated Signature signatures = 2;
33*61c4878aSAndroid Build Coastguard Worker}
34*61c4878aSAndroid Build Coastguard Worker
35*61c4878aSAndroid Build Coastguard Workermessage SignedTimestampMetadata {
36*61c4878aSAndroid Build Coastguard Worker  // Serialized TimestampMetadata message that is the data portion of the
37*61c4878aSAndroid Build Coastguard Worker  // metadata.
38*61c4878aSAndroid Build Coastguard Worker  bytes serialized_timestamp_metadata = 1;
39*61c4878aSAndroid Build Coastguard Worker
40*61c4878aSAndroid Build Coastguard Worker  // Signature of the canonical form of the role's serialized metadata
41*61c4878aSAndroid Build Coastguard Worker  // (serialized_timestamp_metadata).
42*61c4878aSAndroid Build Coastguard Worker  repeated Signature signatures = 2;
43*61c4878aSAndroid Build Coastguard Worker}
44*61c4878aSAndroid Build Coastguard Worker
45*61c4878aSAndroid Build Coastguard Workermessage SignedSnapshotMetadata {
46*61c4878aSAndroid Build Coastguard Worker  // Serialized SnapshotMetadata message that is the data portion of the
47*61c4878aSAndroid Build Coastguard Worker  // metadata.
48*61c4878aSAndroid Build Coastguard Worker  bytes serialized_snapshot_metadata = 1;
49*61c4878aSAndroid Build Coastguard Worker
50*61c4878aSAndroid Build Coastguard Worker  // Signature of the canonical form of the role's serialized metadata
51*61c4878aSAndroid Build Coastguard Worker  // (serialized_snapshot_metadata).
52*61c4878aSAndroid Build Coastguard Worker  repeated Signature signatures = 2;
53*61c4878aSAndroid Build Coastguard Worker}
54*61c4878aSAndroid Build Coastguard Worker
55*61c4878aSAndroid Build Coastguard Workermessage SignedTargetsMetadata {
56*61c4878aSAndroid Build Coastguard Worker  // Serialized TargetsMetadata message that is the data portion of the
57*61c4878aSAndroid Build Coastguard Worker  // metadata.
58*61c4878aSAndroid Build Coastguard Worker  bytes serialized_targets_metadata = 1;
59*61c4878aSAndroid Build Coastguard Worker
60*61c4878aSAndroid Build Coastguard Worker  // Signature of the canonical form of the role's serialized metadata
61*61c4878aSAndroid Build Coastguard Worker  // (serialized_targets_metadata).
62*61c4878aSAndroid Build Coastguard Worker  repeated Signature signatures = 2;
63*61c4878aSAndroid Build Coastguard Worker}
64*61c4878aSAndroid Build Coastguard Worker
65*61c4878aSAndroid Build Coastguard Workermessage CommonMetadata {
66*61c4878aSAndroid Build Coastguard Worker  // Version number of the TUF Specification.
67*61c4878aSAndroid Build Coastguard Worker  // Follows the Semantic Versioning 2.0.0 (semver) format. Metadata is
68*61c4878aSAndroid Build Coastguard Worker  // written according to this version, and clients MUST verify that
69*61c4878aSAndroid Build Coastguard Worker  // "spec_version" matches the expected version number.
70*61c4878aSAndroid Build Coastguard Worker  // E.g. "1.0.0".
71*61c4878aSAndroid Build Coastguard Worker  string spec_version = 1;
72*61c4878aSAndroid Build Coastguard Worker
73*61c4878aSAndroid Build Coastguard Worker  // Metadata file version.
74*61c4878aSAndroid Build Coastguard Worker  // Clients MUST NOT replace a metadata file with a version number less than
75*61c4878aSAndroid Build Coastguard Worker  // the one currently trusted.
76*61c4878aSAndroid Build Coastguard Worker  uint32 version = 2;
77*61c4878aSAndroid Build Coastguard Worker
78*61c4878aSAndroid Build Coastguard Worker  // Expiration time for the metadata.
79*61c4878aSAndroid Build Coastguard Worker  // Indicates when this metadata should be considered expired and no longer
80*61c4878aSAndroid Build Coastguard Worker  // trusted by clients. Notice the TUF Specification defines this as a JSON
81*61c4878aSAndroid Build Coastguard Worker  // string following the ISO 8601 standard. The expected format of the date and
82*61c4878aSAndroid Build Coastguard Worker  // time string is "YYYY-MM-DDTHH:MM:SSZ". Time is always in UTC, and the "Z"
83*61c4878aSAndroid Build Coastguard Worker  // time zone designator is attached to indicate a zero UTC offset.
84*61c4878aSAndroid Build Coastguard Worker  // E.g. "2030-08-26T16:48:27Z".
85*61c4878aSAndroid Build Coastguard Worker  optional google.protobuf.Timestamp expires = 3;
86*61c4878aSAndroid Build Coastguard Worker
87*61c4878aSAndroid Build Coastguard Worker  // Role type for the metadata.
88*61c4878aSAndroid Build Coastguard Worker  // Indicates the type of the metadata. Valid values are 'root', 'targets',
89*61c4878aSAndroid Build Coastguard Worker  // 'snapshot' and 'timestamp' as defined in the TUF spec, though we don't
90*61c4878aSAndroid Build Coastguard Worker  // plan to support 'mirrors'.
91*61c4878aSAndroid Build Coastguard Worker  //
92*61c4878aSAndroid Build Coastguard Worker  // This field serves as a "magic code" that identifies a particular type of
93*61c4878aSAndroid Build Coastguard Worker  // a metadata. During verification, the client is expected to check this
94*61c4878aSAndroid Build Coastguard Worker  // field against the expected role type immediately after verifying the
95*61c4878aSAndroid Build Coastguard Worker  // signatures of a metadata. This can be considered a "confidence booster"
96*61c4878aSAndroid Build Coastguard Worker  // in the absence of canonical protobuf -- i.e. it makes the various
97*61c4878aSAndroid Build Coastguard Worker  // `serialized_x_metadata` fields more tamper resistant.
98*61c4878aSAndroid Build Coastguard Worker  optional string role = 4;
99*61c4878aSAndroid Build Coastguard Worker}
100*61c4878aSAndroid Build Coastguard Worker
101*61c4878aSAndroid Build Coastguard Worker// This content is signed.
102*61c4878aSAndroid Build Coastguard Workermessage RootMetadata {
103*61c4878aSAndroid Build Coastguard Worker  CommonMetadata common_metadata = 1;
104*61c4878aSAndroid Build Coastguard Worker
105*61c4878aSAndroid Build Coastguard Worker  // Whether the repo supports consistent snapshots. If the repo has frequent
106*61c4878aSAndroid Build Coastguard Worker  // updates, you should set this to true.
107*61c4878aSAndroid Build Coastguard Worker  bool consistent_snapshot = 2;
108*61c4878aSAndroid Build Coastguard Worker
109*61c4878aSAndroid Build Coastguard Worker  // Map from Keyid to Key.
110*61c4878aSAndroid Build Coastguard Worker  // Keyid is a unique identifier that identifies a cryptographic key.
111*61c4878aSAndroid Build Coastguard Worker  // Contains all of cryptographic keys used by this repository.
112*61c4878aSAndroid Build Coastguard Worker  repeated KeyMapping keys = 3;
113*61c4878aSAndroid Build Coastguard Worker
114*61c4878aSAndroid Build Coastguard Worker  // KeyConfig is the list of keys use for a particular role and the threshold.
115*61c4878aSAndroid Build Coastguard Worker  // Threshold is number of keys of that role whose signatures are required in
116*61c4878aSAndroid Build Coastguard Worker  // order to consider a file as being properly signed by that role.
117*61c4878aSAndroid Build Coastguard Worker  SignatureRequirement root_signature_requirement = 4;
118*61c4878aSAndroid Build Coastguard Worker  SignatureRequirement timestamp_signature_requirement = 5;
119*61c4878aSAndroid Build Coastguard Worker  SignatureRequirement snapshot_signature_requirement = 6;
120*61c4878aSAndroid Build Coastguard Worker  SignatureRequirement targets_signature_requirement = 7;
121*61c4878aSAndroid Build Coastguard Worker
122*61c4878aSAndroid Build Coastguard Worker  // This is NOT a part of the TUF Specification.
123*61c4878aSAndroid Build Coastguard Worker  reserved 8 to 31;  // Reserved for TUF Specification changes.
124*61c4878aSAndroid Build Coastguard Worker
125*61c4878aSAndroid Build Coastguard Worker  reserved 32 to 64;  // Reserved for future Pigweed usage.
126*61c4878aSAndroid Build Coastguard Worker
127*61c4878aSAndroid Build Coastguard Worker  reserved 65 to 255;  // Reserved for project-specific usage.
128*61c4878aSAndroid Build Coastguard Worker}
129*61c4878aSAndroid Build Coastguard Worker
130*61c4878aSAndroid Build Coastguard Worker// The timestamp role is used for freshness check of the snapshot. Any
131*61c4878aSAndroid Build Coastguard Worker// project-specific update metadata should go in the top-level targets_metadata
132*61c4878aSAndroid Build Coastguard Worker// or with the TargetFile information
133*61c4878aSAndroid Build Coastguard Workermessage TimestampMetadata {
134*61c4878aSAndroid Build Coastguard Worker  CommonMetadata common_metadata = 1;
135*61c4878aSAndroid Build Coastguard Worker
136*61c4878aSAndroid Build Coastguard Worker  // Only one snapshot_metadata is used per timestamp.
137*61c4878aSAndroid Build Coastguard Worker  MetadataFile snapshot_metadata = 2;
138*61c4878aSAndroid Build Coastguard Worker
139*61c4878aSAndroid Build Coastguard Worker  // This is NOT a part of the TUF Specification.
140*61c4878aSAndroid Build Coastguard Worker  reserved 3 to 31;  // Reserved for TUF Specification changes.
141*61c4878aSAndroid Build Coastguard Worker
142*61c4878aSAndroid Build Coastguard Worker  reserved 32 to 64;  // Reserved for future Pigweed usage.
143*61c4878aSAndroid Build Coastguard Worker
144*61c4878aSAndroid Build Coastguard Worker  reserved 65 to 255;  // Reserved for project-specific usage.
145*61c4878aSAndroid Build Coastguard Worker}
146*61c4878aSAndroid Build Coastguard Worker
147*61c4878aSAndroid Build Coastguard Worker// The snapshot role is used to ensure that the collection of targets_metadata
148*61c4878aSAndroid Build Coastguard Worker// files is securely consistent (no target metadata mix and match). Any
149*61c4878aSAndroid Build Coastguard Worker// project-specific update metadata should go in the top-level targets_metadata
150*61c4878aSAndroid Build Coastguard Worker// or with the TargetFile information
151*61c4878aSAndroid Build Coastguard Workermessage SnapshotMetadata {
152*61c4878aSAndroid Build Coastguard Worker  CommonMetadata common_metadata = 1;
153*61c4878aSAndroid Build Coastguard Worker
154*61c4878aSAndroid Build Coastguard Worker  // Map from Target metadata file name to MetadataFile.
155*61c4878aSAndroid Build Coastguard Worker  // File name can be an arbitrary name or a full file name with relative path.
156*61c4878aSAndroid Build Coastguard Worker  // This map should contain an entry for the top level targets role and all
157*61c4878aSAndroid Build Coastguard Worker  // delegated roles.
158*61c4878aSAndroid Build Coastguard Worker  repeated MetadataFile targets_metadata = 2;
159*61c4878aSAndroid Build Coastguard Worker
160*61c4878aSAndroid Build Coastguard Worker  // This is NOT a part of the TUF Specification.
161*61c4878aSAndroid Build Coastguard Worker  reserved 3 to 31;  // Reserved for TUF Specification changes.
162*61c4878aSAndroid Build Coastguard Worker
163*61c4878aSAndroid Build Coastguard Worker  reserved 32 to 64;  // Reserved for future Pigweed usage.
164*61c4878aSAndroid Build Coastguard Worker
165*61c4878aSAndroid Build Coastguard Worker  reserved 65 to 255;  // Reserved for project-specific usage.
166*61c4878aSAndroid Build Coastguard Worker}
167*61c4878aSAndroid Build Coastguard Worker
168*61c4878aSAndroid Build Coastguard Worker// The targets role describes the target files that comprise the software
169*61c4878aSAndroid Build Coastguard Worker// update. Targets metadata is organized in to a top-level targets metadata file
170*61c4878aSAndroid Build Coastguard Worker// and optional multiple deligated targets metadata files
171*61c4878aSAndroid Build Coastguard Worker//
172*61c4878aSAndroid Build Coastguard Worker// The top-level targets metatdata is the correct place to put any
173*61c4878aSAndroid Build Coastguard Worker// project-specific build version information, including build ID, hardware rev,
174*61c4878aSAndroid Build Coastguard Worker// etc.
175*61c4878aSAndroid Build Coastguard Workermessage TargetsMetadata {
176*61c4878aSAndroid Build Coastguard Worker  CommonMetadata common_metadata = 1;
177*61c4878aSAndroid Build Coastguard Worker
178*61c4878aSAndroid Build Coastguard Worker  // Collection of target file information
179*61c4878aSAndroid Build Coastguard Worker  repeated TargetFile target_files = 2;
180*61c4878aSAndroid Build Coastguard Worker  // Target file name can be an arbitrary name or a path that describes where
181*61c4878aSAndroid Build Coastguard Worker  // the file lives relative to the base directory of the repository, e.g.
182*61c4878aSAndroid Build Coastguard Worker  // "path/to/amber_tools/0".
183*61c4878aSAndroid Build Coastguard Worker
184*61c4878aSAndroid Build Coastguard Worker  // TODO(davidrogers): When it is time to support delegation, add delegation
185*61c4878aSAndroid Build Coastguard Worker  // information here.
186*61c4878aSAndroid Build Coastguard Worker
187*61c4878aSAndroid Build Coastguard Worker  // This is NOT a part of the TUF Specification.
188*61c4878aSAndroid Build Coastguard Worker  reserved 9 to 31;  // Reserved for TUF Specification changes.
189*61c4878aSAndroid Build Coastguard Worker
190*61c4878aSAndroid Build Coastguard Worker  reserved 32 to 64;  // Reserved for future Pigweed usage.
191*61c4878aSAndroid Build Coastguard Worker
192*61c4878aSAndroid Build Coastguard Worker  reserved 65 to 255;  // Reserved for project-specific usage.
193*61c4878aSAndroid Build Coastguard Worker}
194*61c4878aSAndroid Build Coastguard Worker
195*61c4878aSAndroid Build Coastguard Workermessage Signature {
196*61c4878aSAndroid Build Coastguard Worker  // Identifier of the key, which is bytes of the SHA-256 hash of the
197*61c4878aSAndroid Build Coastguard Worker  // canonical form of the key.
198*61c4878aSAndroid Build Coastguard Worker  bytes key_id = 1;
199*61c4878aSAndroid Build Coastguard Worker
200*61c4878aSAndroid Build Coastguard Worker  // The signature of the canonical form of the role's serialized metadata
201*61c4878aSAndroid Build Coastguard Worker  // (serialized_{root,timestamp,snapshot,targets}_metadata).
202*61c4878aSAndroid Build Coastguard Worker  bytes sig = 2;
203*61c4878aSAndroid Build Coastguard Worker}
204*61c4878aSAndroid Build Coastguard Worker
205*61c4878aSAndroid Build Coastguard Workermessage KeyMapping {
206*61c4878aSAndroid Build Coastguard Worker  // Identifier of the key, which is bytes of the SHA-256 hash of the
207*61c4878aSAndroid Build Coastguard Worker  // canonical form of the key.
208*61c4878aSAndroid Build Coastguard Worker  bytes key_id = 1;
209*61c4878aSAndroid Build Coastguard Worker
210*61c4878aSAndroid Build Coastguard Worker  // Cryptographic key
211*61c4878aSAndroid Build Coastguard Worker  Key key = 2;
212*61c4878aSAndroid Build Coastguard Worker}
213*61c4878aSAndroid Build Coastguard Worker
214*61c4878aSAndroid Build Coastguard Worker// Identifies an asymmetric cryptographic key.
215*61c4878aSAndroid Build Coastguard Workermessage Key {
216*61c4878aSAndroid Build Coastguard Worker  // Denotes a public key signature system, such as RSA or ECDSA.
217*61c4878aSAndroid Build Coastguard Worker  KeyType key_type = 1;
218*61c4878aSAndroid Build Coastguard Worker
219*61c4878aSAndroid Build Coastguard Worker  // Denotes the signature scheme corresponding to the key type. For example:
220*61c4878aSAndroid Build Coastguard Worker  // "rsassa-pss-sha256" or "ecdsa-sha2-nistp256".
221*61c4878aSAndroid Build Coastguard Worker  KeyScheme scheme = 2;
222*61c4878aSAndroid Build Coastguard Worker
223*61c4878aSAndroid Build Coastguard Worker  // Stores the serialized public key for this cryptographic algorithm.
224*61c4878aSAndroid Build Coastguard Worker  bytes keyval = 3;
225*61c4878aSAndroid Build Coastguard Worker}
226*61c4878aSAndroid Build Coastguard Worker
227*61c4878aSAndroid Build Coastguard Worker// The set of cryptographic keys used by a specific role. For example, list of
228*61c4878aSAndroid Build Coastguard Worker// key_ids used by the top level role "root".
229*61c4878aSAndroid Build Coastguard Workermessage SignatureRequirement {
230*61c4878aSAndroid Build Coastguard Worker  // Set of Keyid's.
231*61c4878aSAndroid Build Coastguard Worker  // Keyid is a unique identifier that identifies a cryptographic key.
232*61c4878aSAndroid Build Coastguard Worker  // E.g. "f2d5020d08aea06a0a9192eb6a4f549e17032ebefa1aa9ac167c1e3e727930d6".
233*61c4878aSAndroid Build Coastguard Worker  repeated bytes key_ids = 1;
234*61c4878aSAndroid Build Coastguard Worker
235*61c4878aSAndroid Build Coastguard Worker  // Threshold of signatures required to trust given file.
236*61c4878aSAndroid Build Coastguard Worker  // In other words; the number of keys of that role whose signatures are
237*61c4878aSAndroid Build Coastguard Worker  // required in order to consider a file as being properly signed by that role.
238*61c4878aSAndroid Build Coastguard Worker  uint32 threshold = 2;
239*61c4878aSAndroid Build Coastguard Worker}
240*61c4878aSAndroid Build Coastguard Worker
241*61c4878aSAndroid Build Coastguard Workerenum HashFunction {
242*61c4878aSAndroid Build Coastguard Worker  // Never use this in any TUF metadata.
243*61c4878aSAndroid Build Coastguard Worker  UNKNOWN_HASH_FUNCTION = 0;
244*61c4878aSAndroid Build Coastguard Worker
245*61c4878aSAndroid Build Coastguard Worker  SHA256 = 1;
246*61c4878aSAndroid Build Coastguard Worker}
247*61c4878aSAndroid Build Coastguard Worker
248*61c4878aSAndroid Build Coastguard Workermessage Hash {
249*61c4878aSAndroid Build Coastguard Worker  HashFunction function = 1;
250*61c4878aSAndroid Build Coastguard Worker  // Digest of the cryptographic hash function computed on the target file.
251*61c4878aSAndroid Build Coastguard Worker  bytes hash = 2;
252*61c4878aSAndroid Build Coastguard Worker}
253*61c4878aSAndroid Build Coastguard Worker
254*61c4878aSAndroid Build Coastguard Worker// Descriptor for a file stored in this repository. Linked to from target
255*61c4878aSAndroid Build Coastguard Worker// metadata.
256*61c4878aSAndroid Build Coastguard Workermessage TargetFile {
257*61c4878aSAndroid Build Coastguard Worker  // Target file name can be an arbitrary name or a path that describes where
258*61c4878aSAndroid Build Coastguard Worker  // the file lives relative to the base directory of the repository, e.g.
259*61c4878aSAndroid Build Coastguard Worker  // "path/to/amber_tools/0".
260*61c4878aSAndroid Build Coastguard Worker  string file_name = 1;
261*61c4878aSAndroid Build Coastguard Worker
262*61c4878aSAndroid Build Coastguard Worker  // Size of the target file (element payload) in bytes. This the size as stored
263*61c4878aSAndroid Build Coastguard Worker  // in the bundle. The final applied size can be different due to optional
264*61c4878aSAndroid Build Coastguard Worker  // compression.
265*61c4878aSAndroid Build Coastguard Worker  uint64 length = 2;
266*61c4878aSAndroid Build Coastguard Worker
267*61c4878aSAndroid Build Coastguard Worker  // Map from algorithm name to Hash.
268*61c4878aSAndroid Build Coastguard Worker  // Algorithm name is the name of a cryptographic hash function. E.g. "sha256".
269*61c4878aSAndroid Build Coastguard Worker  // The Hash string is the hex digest of the cryptographic function computed on
270*61c4878aSAndroid Build Coastguard Worker  // the target file. E.g.
271*61c4878aSAndroid Build Coastguard Worker  // "65b8c67f51c993d898250f40aa57a317d854900b3a04895464313e48785440da".
272*61c4878aSAndroid Build Coastguard Worker  repeated Hash hashes = 3;
273*61c4878aSAndroid Build Coastguard Worker
274*61c4878aSAndroid Build Coastguard Worker  // This is NOT a part of the TUF Specification.
275*61c4878aSAndroid Build Coastguard Worker  reserved 4 to 15;  // Reserved for TUF Specification changes.
276*61c4878aSAndroid Build Coastguard Worker
277*61c4878aSAndroid Build Coastguard Worker  reserved 16 to 31;  // Reserved for future Pigweed usage.
278*61c4878aSAndroid Build Coastguard Worker
279*61c4878aSAndroid Build Coastguard Worker  reserved 32 to 255;  // Reserved for future project-specific usage.
280*61c4878aSAndroid Build Coastguard Worker}
281*61c4878aSAndroid Build Coastguard Worker
282*61c4878aSAndroid Build Coastguard Workermessage MetadataFile {
283*61c4878aSAndroid Build Coastguard Worker  // Target file name can be an arbitrary name or a path that describes where
284*61c4878aSAndroid Build Coastguard Worker  // the file lives relative to the base directory of the repository, e.g.
285*61c4878aSAndroid Build Coastguard Worker  // "path/to/target/0".
286*61c4878aSAndroid Build Coastguard Worker  optional string file_name = 1;
287*61c4878aSAndroid Build Coastguard Worker
288*61c4878aSAndroid Build Coastguard Worker  // Metadata file version. E.g. 3.
289*61c4878aSAndroid Build Coastguard Worker  uint32 version = 2;
290*61c4878aSAndroid Build Coastguard Worker
291*61c4878aSAndroid Build Coastguard Worker  // Size of the target file in bytes.
292*61c4878aSAndroid Build Coastguard Worker  optional uint64 length = 3;
293*61c4878aSAndroid Build Coastguard Worker
294*61c4878aSAndroid Build Coastguard Worker  // Map from algorithm name to Hash.
295*61c4878aSAndroid Build Coastguard Worker  // Algorithm name is the name of a cryptographic hash function. E.g. "sha256".
296*61c4878aSAndroid Build Coastguard Worker  // The Hash is the hex digest of the cryptographic function computed on the
297*61c4878aSAndroid Build Coastguard Worker  // target file. E.g.
298*61c4878aSAndroid Build Coastguard Worker  // "65b8c67f51c993d898250f40aa57a317d854900b3a04895464313e48785440da".
299*61c4878aSAndroid Build Coastguard Worker  repeated Hash hashes = 4;
300*61c4878aSAndroid Build Coastguard Worker}
301*61c4878aSAndroid Build Coastguard Worker
302*61c4878aSAndroid Build Coastguard Workerenum KeyType {
303*61c4878aSAndroid Build Coastguard Worker  // Never use this in any TUF metadata.
304*61c4878aSAndroid Build Coastguard Worker  UNKNOWN_KEY_TYPE = 0;
305*61c4878aSAndroid Build Coastguard Worker
306*61c4878aSAndroid Build Coastguard Worker  RSA = 1;
307*61c4878aSAndroid Build Coastguard Worker
308*61c4878aSAndroid Build Coastguard Worker  ED25519 = 2;
309*61c4878aSAndroid Build Coastguard Worker
310*61c4878aSAndroid Build Coastguard Worker  ECDSA_SHA2_NISTP256 = 3;
311*61c4878aSAndroid Build Coastguard Worker}
312*61c4878aSAndroid Build Coastguard Worker
313*61c4878aSAndroid Build Coastguard Workerenum KeyScheme {
314*61c4878aSAndroid Build Coastguard Worker  // Never use this in any TUF metadata.
315*61c4878aSAndroid Build Coastguard Worker  UNKNOWN_KEY_SCHEME = 0;
316*61c4878aSAndroid Build Coastguard Worker
317*61c4878aSAndroid Build Coastguard Worker  // RSA Probabilistic signature scheme with appendix.
318*61c4878aSAndroid Build Coastguard Worker  // The underlying hash function is SHA256.
319*61c4878aSAndroid Build Coastguard Worker  // In TUF Specification, this is referred to as "rsassa-pss-sha256".
320*61c4878aSAndroid Build Coastguard Worker  RSASSA_PSS_SHA256_SCHEME = 1;
321*61c4878aSAndroid Build Coastguard Worker
322*61c4878aSAndroid Build Coastguard Worker  // Elliptic Curve digital signature algorithm based on Twisted Edwards curves.
323*61c4878aSAndroid Build Coastguard Worker  // See https://ed25519.cr.yp.to/.
324*61c4878aSAndroid Build Coastguard Worker  // In TUF Specification, it is referred to as "ed25519".
325*61c4878aSAndroid Build Coastguard Worker  ED25519_SCHEME = 2;
326*61c4878aSAndroid Build Coastguard Worker
327*61c4878aSAndroid Build Coastguard Worker  // Elliptic Curve Digital Signature Algorithm with NIST P-256 curve signing
328*61c4878aSAndroid Build Coastguard Worker  // and SHA-256 hashing. See
329*61c4878aSAndroid Build Coastguard Worker  // https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm In
330*61c4878aSAndroid Build Coastguard Worker  // TUF Specification, it is referred to as "ecdsa-sha2-nistp256".
331*61c4878aSAndroid Build Coastguard Worker  ECDSA_SHA2_NISTP256_SCHEME = 3;
332*61c4878aSAndroid Build Coastguard Worker}
333