Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / quic / p2p / quic_p2p_crypto_config.h
blob525f55be875ae96d1d40a0c604e23f1757419c85
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 #ifndef NET_QUIC_P2P_QUIC_P2P_CRYPTO_CONFIG_H_
6 #define NET_QUIC_P2P_QUIC_P2P_CRYPTO_CONFIG_H_
8 #include <string>
10 #include "net/quic/crypto/crypto_protocol.h"
12 namespace net {
14 struct QuicCryptoNegotiatedParameters;
16 // Crypto configuration for P2P sessions.
17 class NET_EXPORT QuicP2PCryptoConfig {
18 public:
19 // |shared_key| specifies a key that's used to generate crypto keys. The key
20 // must be exchanged out-of-bound when the P2P transport is negotiated.
21 QuicP2PCryptoConfig(const std::string& shared_key);
22 ~QuicP2PCryptoConfig();
24 void set_aead(QuicTag aead) { aead_ = aead; }
26 // Sets suffix for HKDF. E.g. can be channel name to make sure different
27 // channels use different encryption keys derived from the same |shared_key|.
28 // Empty by default.
29 void set_hkdf_input_suffix(const std::string& hkdf_input_suffix) {
30 hkdf_input_suffix_ = hkdf_input_suffix;
33 bool GetNegotiatedParameters(Perspective perspective,
34 QuicCryptoNegotiatedParameters* out_params);
36 private:
37 QuicTag aead_ = kAESG;
38 std::string shared_key_;
39 std::string hkdf_input_suffix_;
42 } // namespace net
44 #endif // NET_QUIC_P2P_QUIC_P2P_CRYPTO_CONFIG_H_