// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef QUICHE_QUIC_CORE_CRYPTO_KEY_EXCHANGE_H_ #define QUICHE_QUIC_CORE_CRYPTO_KEY_EXCHANGE_H_ #include <memory> #include <string> #include "absl/strings/string_view.h" #include "quiche/quic/core/crypto/crypto_protocol.h" #include "quiche/quic/core/crypto/quic_random.h" #include "quiche/quic/platform/api/quic_export.h" namespace quic { // Interface for a Diffie-Hellman key exchange with an asynchronous interface. // This allows for implementations which hold the private key locally, as well // as ones which make an RPC to an external key-exchange service. class QUICHE_EXPORT AsynchronousKeyExchange { … }; // Interface for a Diffie-Hellman key exchange with both synchronous and // asynchronous interfaces. Only implementations which hold the private key // locally should implement this interface. class QUICHE_EXPORT SynchronousKeyExchange : public AsynchronousKeyExchange { … }; // Create a SynchronousKeyExchange object which will use a keypair generated // from |private_key|, and a key-exchange algorithm specified by |type|, which // must be one of {kC255, kC256}. Returns nullptr if |private_key| or |type| is // invalid. std::unique_ptr<SynchronousKeyExchange> CreateLocalSynchronousKeyExchange( QuicTag type, absl::string_view private_key); // Create a SynchronousKeyExchange object which will use a keypair generated // from |rand|, and a key-exchange algorithm specified by |type|, which must be // one of {kC255, kC256}. Returns nullptr if |type| is invalid. std::unique_ptr<SynchronousKeyExchange> CreateLocalSynchronousKeyExchange( QuicTag type, QuicRandom* rand); } // namespace quic #endif // QUICHE_QUIC_CORE_CRYPTO_KEY_EXCHANGE_H_