summaryrefslogtreecommitdiff
path: root/chromium/components/crx_file/crx3.proto
blob: 2ea91f1c937a1aefddcf036244789cd415763f52 (plain)
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
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package crx_file;

// A CRX₃ file is a binary file of the following format:
// [4 octets]: "Cr24", a magic number.
// [4 octets]: The version of the *.crx file format used (currently 3).
// [4 octets]: N, little-endian, the length of the header section.
// [N octets]: The header (the binary encoding of a CrxFileHeader).
// [M octets]: The ZIP archive.
// Clients should reject CRX₃ files that contain an N that is too large for the
// client to safely handle in memory.

message CrxFileHeader {
  // PSS signature with RSA public key. The public key is formatted as a
  // X.509 SubjectPublicKeyInfo block, as in CRX₂. In the common case of a
  // developer key proof, the first 128 bits of the SHA-256 hash of the
  // public key must equal the crx_id.
  repeated AsymmetricKeyProof sha256_with_rsa = 2;

  // ECDSA signature, using the NIST P-256 curve. Public key appears in
  // named-curve format.
  // The pinned algorithm will be this, at least on 2017-01-01.
  repeated AsymmetricKeyProof sha256_with_ecdsa = 3;

  // The binary form of a SignedData message. We do not use a nested
  // SignedData message, as handlers of this message must verify the proofs
  // on exactly these bytes, so it is convenient to parse in two steps.
  //
  // All proofs in this CrxFile message are on the value
  // "CRX3 SignedData\x00" + signed_header_size + signed_header_data +
  // archive, where "\x00" indicates an octet with value 0, "CRX3 SignedData"
  // is encoded using UTF-8, signed_header_size is the size in octets of the
  // contents of this field and is encoded using 4 octets in little-endian
  // order, signed_header_data is exactly the content of this field, and
  // archive is the remaining contents of the file following the header.
  optional bytes signed_header_data = 10000;
}

message AsymmetricKeyProof {
  optional bytes public_key = 1;
  optional bytes signature = 2;
}

message SignedData {
  // This is simple binary, not UTF-8 encoded mpdecimal; i.e. it is exactly
  // 16 bytes long.
  optional bytes crx_id = 1;
}