File: securemessage.proto

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (116 lines) | stat: -rw-r--r-- 3,551 bytes parent folder | download
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
// Copyright 2015 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.

// Definitions related to the SecureMessage format, used by CryptAuth. Do not
// edit unless transcribing from server definitions.
syntax = "proto2";

package securemessage;

option optimize_for = LITE_RUNTIME;

message SecureMessage {
  // Must contain a HeaderAndBody message.
  required bytes header_and_body = 1;
  // Signature of header_and_body.
  required bytes signature = 2;
}

// Supported "signature" schemes (both symmetric key and public key based).
enum SigScheme {
  HMAC_SHA256 = 1;
  ECDSA_P256_SHA256 = 2;
  // Not recommended -- use ECDSA_P256_SHA256 instead
  RSA2048_SHA256 = 3;
}

// Supported encryption schemes.
enum EncScheme {
  // No encryption.
  NONE = 1;
  AES_256_CBC = 2;
}

message Header {
  required SigScheme signature_scheme = 1;
  required EncScheme encryption_scheme = 2;
  // Identifies the verification key.
  optional bytes verification_key_id = 3;
  // Identifies the decryption key.
  optional bytes decryption_key_id = 4;
  // Encryption may use an IV.
  optional bytes iv = 5;
  // Arbitrary per-protocol public data, to be sent with the plain-text header.
  optional bytes public_metadata = 6;
  // The length of some associated data that is not sent in this SecureMessage,
  // but which will be bound to the signature.
  optional uint32 associated_data_length = 7 [default = 0];
}

message HeaderAndBody {
  // Public data about this message (to be bound in the signature).
  required Header header = 1;
  // Payload data.
  required bytes body = 2;
}

// A list of supported public key types.
enum PublicKeyType {
  EC_P256 = 1;
  RSA2048 = 2;
  // 2048-bit MODP group 14, from RFC 3526.
  DH2048_MODP = 3;
}

// A convenience proto for encoding NIST P-256 elliptic curve public keys.
message EcP256PublicKey {
  // x and y are encoded in big-endian two's complement (slightly wasteful)
  // Client MUST verify (x,y) is a valid point on NIST P256.
  required bytes x = 1;
  required bytes y = 2;
}

// A convenience proto for encoding RSA public keys with small exponents.
message SimpleRsaPublicKey {
  // Encoded in big-endian two's complement.
  required bytes n = 1;
  optional int32 e = 2 [default = 65537];
}

// A convenience proto for encoding Diffie-Hellman public keys,
// for use only when Elliptic Curve based key exchanges are not possible.
// (Note that the group parameters must be specified separately).
message DhPublicKey {
  // Big-endian two's complement encoded group element.
  required bytes y = 1;
}

message GenericPublicKey {
  required PublicKeyType type = 1;
  optional EcP256PublicKey ec_p256_public_key = 2;
  optional SimpleRsaPublicKey rsa2048_public_key = 3;
  // Use only as a last resort.
  optional DhPublicKey dh2048_public_key = 4;
}

// Used by protocols for communicating between a pair of devices.
message DeviceToDeviceMessage {
  // The payload of the message.
  optional bytes message = 1;

  // The sequence number of the message - must be increasing.
  optional int32 sequence_number = 2;
}

// Sent as the first message from initiator to responder in an unauthenticated
// Diffie-Hellman Key Exchange.
message InitiatorHello {
  optional GenericPublicKey public_dh_key = 1;
}

// Sent inside the header of the first message from the responder to the
// initiator in an unauthenticated Diffie-Hellman Key Exchange.
message ResponderHello {
  optional GenericPublicKey public_dh_key = 1;
}