1 // Copyright 2015 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.
5 // Definitions related to the SecureMessage format, used by CryptAuth. Do not
6 // edit unless transcribing from server definitions.
11 option optimize_for = LITE_RUNTIME;
13 message SecureMessage {
14 // Must contain a HeaderAndBody message.
15 required bytes header_and_body = 1;
16 // Signature of header_and_body.
17 required bytes signature = 2;
20 // Supported "signature" schemes (both symmetric key and public key based).
23 ECDSA_P256_SHA256 = 2;
24 // Not recommended -- use ECDSA_P256_SHA256 instead
28 // Supported encryption schemes.
36 required SigScheme signature_scheme = 1;
37 required EncScheme encryption_scheme = 2;
38 // Identifies the verification key.
39 optional bytes verification_key_id = 3;
40 // Identifies the decryption key.
41 optional bytes decryption_key_id = 4;
42 // Encryption may use an IV.
43 optional bytes iv = 5;
44 // Arbitrary per-protocol public data, to be sent with the plain-text header.
45 optional bytes public_metadata = 6;
46 // The length of some associated data that is not sent in this SecureMessage,
47 // but which will be bound to the signature.
48 optional uint32 associated_data_length = 7 [default = 0];
51 message HeaderAndBody {
52 // Public data about this message (to be bound in the signature).
53 required Header header = 1;
55 required bytes body = 2;
58 // A list of supported public key types.
62 // 2048-bit MODP group 14, from RFC 3526.
66 // A convenience proto for encoding NIST P-256 elliptic curve public keys.
67 message EcP256PublicKey {
68 // x and y are encoded in big-endian two's complement (slightly wasteful)
69 // Client MUST verify (x,y) is a valid point on NIST P256.
74 // A convenience proto for encoding RSA public keys with small exponents.
75 message SimpleRsaPublicKey {
76 // Encoded in big-endian two's complement.
78 optional int32 e = 2 [default = 65537];
81 // A convenience proto for encoding Diffie-Hellman public keys,
82 // for use only when Elliptic Curve based key exchanges are not possible.
83 // (Note that the group parameters must be specified separately).
85 // Big-endian two's complement encoded group element.
89 message GenericPublicKey {
90 required PublicKeyType type = 1;
91 optional EcP256PublicKey ec_p256_public_key = 2;
92 optional SimpleRsaPublicKey rsa2048_public_key = 3;
93 // Use only as a last resort.
94 optional DhPublicKey dh2048_public_key = 4;