Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Side by Side Diff: net/quic/crypto/crypto_handshake_message.h

Issue 154643006: Add net/quic/crypto/crypto_handshake_message.{cc,h}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/crypto/crypto_handshake_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_
6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ 6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_
7 7
8 #include <map>
9 #include <string> 8 #include <string>
10 #include <vector> 9 #include <vector>
11 10
12 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
14 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
15 #include "net/cert/cert_verify_result.h"
16 #include "net/cert/x509_certificate.h"
17 #include "net/quic/crypto/crypto_protocol.h"
18 #include "net/quic/crypto/proof_verifier.h"
19 #include "net/quic/quic_protocol.h" 14 #include "net/quic/quic_protocol.h"
20 15
21 namespace net { 16 namespace net {
22 17
23 class ChannelIDSigner;
24 class CommonCertSets;
25 class KeyExchange;
26 class ProofVerifier;
27 class QuicDecrypter;
28 class QuicEncrypter;
29 class QuicRandom;
30
31 // An intermediate format of a handshake message that's convenient for a 18 // An intermediate format of a handshake message that's convenient for a
32 // CryptoFramer to serialize from or parse into. 19 // CryptoFramer to serialize from or parse into.
33 class NET_EXPORT_PRIVATE CryptoHandshakeMessage { 20 class NET_EXPORT_PRIVATE CryptoHandshakeMessage {
34 public: 21 public:
35 CryptoHandshakeMessage(); 22 CryptoHandshakeMessage();
36 CryptoHandshakeMessage(const CryptoHandshakeMessage& other); 23 CryptoHandshakeMessage(const CryptoHandshakeMessage& other);
37 ~CryptoHandshakeMessage(); 24 ~CryptoHandshakeMessage();
38 25
39 CryptoHandshakeMessage& operator=(const CryptoHandshakeMessage& other); 26 CryptoHandshakeMessage& operator=(const CryptoHandshakeMessage& other);
40 27
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 QuicTag tag_; 123 QuicTag tag_;
137 QuicTagValueMap tag_value_map_; 124 QuicTagValueMap tag_value_map_;
138 125
139 size_t minimum_size_; 126 size_t minimum_size_;
140 127
141 // The serialized form of the handshake message. This member is constructed 128 // The serialized form of the handshake message. This member is constructed
142 // lasily. 129 // lasily.
143 mutable scoped_ptr<QuicData> serialized_; 130 mutable scoped_ptr<QuicData> serialized_;
144 }; 131 };
145 132
146 // A CrypterPair contains the encrypter and decrypter for an encryption level.
147 struct NET_EXPORT_PRIVATE CrypterPair {
148 CrypterPair();
149 ~CrypterPair();
150 scoped_ptr<QuicEncrypter> encrypter;
151 scoped_ptr<QuicDecrypter> decrypter;
152 };
153
154 // Parameters negotiated by the crypto handshake.
155 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParameters {
156 // Initializes the members to 0 or empty values.
157 QuicCryptoNegotiatedParameters();
158 ~QuicCryptoNegotiatedParameters();
159
160 QuicTag key_exchange;
161 QuicTag aead;
162 std::string initial_premaster_secret;
163 std::string forward_secure_premaster_secret;
164 CrypterPair initial_crypters;
165 CrypterPair forward_secure_crypters;
166 // Normalized SNI: converted to lower case and trailing '.' removed.
167 std::string sni;
168 std::string client_nonce;
169 std::string server_nonce;
170 // hkdf_input_suffix contains the HKDF input following the label: the GUID,
171 // client hello and server config. This is only populated in the client
172 // because only the client needs to derive the forward secure keys at a later
173 // time from the initial keys.
174 std::string hkdf_input_suffix;
175 // cached_certs contains the cached certificates that a client used when
176 // sending a client hello.
177 std::vector<std::string> cached_certs;
178 // client_key_exchange is used by clients to store the ephemeral KeyExchange
179 // for the connection.
180 scoped_ptr<KeyExchange> client_key_exchange;
181 // channel_id is set by servers to a ChannelID key when the client correctly
182 // proves possession of the corresponding private key. It consists of 32
183 // bytes of x coordinate, followed by 32 bytes of y coordinate. Both values
184 // are big-endian and the pair is a P-256 public key.
185 std::string channel_id;
186 // client_address is set by clients to the kCADR value provided by the server
187 // in ServerHello. It is a serialized form of an IP address and port.
188 std::string client_address;
189 };
190
191 // QuicCryptoConfig contains common configuration between clients and servers.
192 class NET_EXPORT_PRIVATE QuicCryptoConfig {
193 public:
194 // kInitialLabel is a constant that is used when deriving the initial
195 // (non-forward secure) keys for the connection in order to tie the resulting
196 // key to this protocol.
197 static const char kInitialLabel[];
198
199 // kCETVLabel is a constant that is used when deriving the keys for the
200 // encrypted tag/value block in the client hello.
201 static const char kCETVLabel[];
202
203 // kForwardSecureLabel is a constant that is used when deriving the forward
204 // secure keys for the connection in order to tie the resulting key to this
205 // protocol.
206 static const char kForwardSecureLabel[];
207
208 QuicCryptoConfig();
209 ~QuicCryptoConfig();
210
211 // Key exchange methods. The following two members' values correspond by
212 // index.
213 QuicTagVector kexs;
214 // Authenticated encryption with associated data (AEAD) algorithms.
215 QuicTagVector aead;
216
217 const CommonCertSets* common_cert_sets;
218
219 private:
220 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig);
221 };
222
223 } // namespace net 133 } // namespace net
224 134
225 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ 135 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/crypto_handshake_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698