| OLD | NEW |
| 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_KEY_EXCHANGE_H_ | 5 #ifndef NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ |
| 6 #define NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ | 6 #define NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 virtual ~KeyExchange() {} | 22 virtual ~KeyExchange() {} |
| 23 | 23 |
| 24 // NewKeyPair generates a new public, private key pair. The caller takes | 24 // NewKeyPair generates a new public, private key pair. The caller takes |
| 25 // ownership of the return value. (This is intended for servers that need to | 25 // ownership of the return value. (This is intended for servers that need to |
| 26 // generate forward-secure keys.) | 26 // generate forward-secure keys.) |
| 27 virtual KeyExchange* NewKeyPair(QuicRandom* rand) const = 0; | 27 virtual KeyExchange* NewKeyPair(QuicRandom* rand) const = 0; |
| 28 | 28 |
| 29 // CalculateSharedKey computes the shared key between the local private key | 29 // CalculateSharedKey computes the shared key between the local private key |
| 30 // (which is implicitly known by a KeyExchange object) and a public value | 30 // (which is implicitly known by a KeyExchange object) and a public value |
| 31 // from the peer. | 31 // from the peer. |
| 32 virtual bool CalculateSharedKey(const base::StringPiece& peer_public_value, | 32 virtual bool CalculateSharedKey(base::StringPiece peer_public_value, |
| 33 std::string* shared_key) const = 0; | 33 std::string* shared_key) const = 0; |
| 34 | 34 |
| 35 // public_value returns the local public key which can be sent to a peer in | 35 // public_value returns the local public key which can be sent to a peer in |
| 36 // order to complete a key exchange. The returned StringPiece is a reference | 36 // order to complete a key exchange. The returned StringPiece is a reference |
| 37 // to a member of the KeyExchange and is only valid for as long as the | 37 // to a member of the KeyExchange and is only valid for as long as the |
| 38 // KeyExchange exists. | 38 // KeyExchange exists. |
| 39 virtual base::StringPiece public_value() const = 0; | 39 virtual base::StringPiece public_value() const = 0; |
| 40 | 40 |
| 41 // tag returns the tag value that identifies this key exchange function. | 41 // tag returns the tag value that identifies this key exchange function. |
| 42 virtual QuicTag tag() const = 0; | 42 virtual QuicTag tag() const = 0; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace net | 45 } // namespace net |
| 46 | 46 |
| 47 #endif // NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ | 47 #endif // NET_QUIC_CRYPTO_KEY_EXCHANGE_H_ |
| OLD | NEW |