OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ |
| 6 #define NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/string_piece.h" |
| 11 #include "net/base/net_export.h" |
| 12 #include "net/quic/crypto/crypto_protocol.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 // KeyExchange is an abstract class that provides an interface to a |
| 17 // key-exchange primitive. |
| 18 class NET_EXPORT_PRIVATE KeyExchange { |
| 19 public: |
| 20 virtual ~KeyExchange() { } |
| 21 |
| 22 // CalculateSharedKey computes the shared key between the local private key |
| 23 // (which is implicitly known by a KeyExchange object) and a public value |
| 24 // from the peer. |
| 25 virtual bool CalculateSharedKey(const base::StringPiece& peer_public_value, |
| 26 std::string* shared_key) const = 0; |
| 27 |
| 28 // public_value returns the local public key which can be sent to a peer in |
| 29 // order to complete a key exchange. The returned StringPiece is a reference |
| 30 // to a member of the KeyExchange and is only valid for as long as the |
| 31 // KeyExchange exists. |
| 32 virtual base::StringPiece public_value() const = 0; |
| 33 |
| 34 // tag returns the tag value that identifies this key exchange function. |
| 35 virtual CryptoTag tag() const = 0; |
| 36 }; |
| 37 |
| 38 } // namespace net |
| 39 |
| 40 #endif // NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ |
OLD | NEW |