crx3.proto 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file
  4. syntax = "proto2";
  5. option optimize_for = LITE_RUNTIME;
  6. package crx_file;
  7. // A CRX₃ file is a binary file of the following format:
  8. // [4 octets]: "Cr24", a magic number.
  9. // [4 octets]: The version of the *.crx file format used (currently 3).
  10. // [4 octets]: N, little-endian, the length of the header section.
  11. // [N octets]: The header (the binary encoding of a CrxFileHeader).
  12. // [M octets]: The ZIP archive.
  13. // Clients should reject CRX₃ files that contain an N that is too large for the
  14. // client to safely handle in memory.
  15. message CrxFileHeader {
  16. // PSS signature with RSA public key. The public key is formatted as a
  17. // X.509 SubjectPublicKeyInfo block, as in CRX₂. In the common case of a
  18. // developer key proof, the first 128 bits of the SHA-256 hash of the
  19. // public key must equal the crx_id.
  20. repeated AsymmetricKeyProof sha256_with_rsa = 2;
  21. // ECDSA signature, using the NIST P-256 curve. Public key appears in
  22. // named-curve format.
  23. // The pinned algorithm will be this, at least on 2017-01-01.
  24. repeated AsymmetricKeyProof sha256_with_ecdsa = 3;
  25. // A verified contents file containing signatures over the archive contents.
  26. // The verified contents are encoded in UTF-8 and then GZIP-compressed.
  27. // Consult
  28. // https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/verified_contents.h
  29. // for information about the verified contents format.
  30. optional bytes verified_contents = 4;
  31. // The binary form of a SignedData message. We do not use a nested
  32. // SignedData message, as handlers of this message must verify the proofs
  33. // on exactly these bytes, so it is convenient to parse in two steps.
  34. //
  35. // All proofs in this CrxFile message are on the value
  36. // "CRX3 SignedData\x00" + signed_header_size + signed_header_data +
  37. // archive, where "\x00" indicates an octet with value 0, "CRX3 SignedData"
  38. // is encoded using UTF-8, signed_header_size is the size in octets of the
  39. // contents of this field and is encoded using 4 octets in little-endian
  40. // order, signed_header_data is exactly the content of this field, and
  41. // archive is the remaining contents of the file following the header.
  42. optional bytes signed_header_data = 10000;
  43. }
  44. message AsymmetricKeyProof {
  45. optional bytes public_key = 1;
  46. optional bytes signature = 2;
  47. }
  48. message SignedData {
  49. // This is simple binary, not UTF-8 encoded mpdecimal; i.e. it is exactly
  50. // 16 bytes long.
  51. optional bytes crx_id = 1;
  52. }