proxygen
X25519.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
12 
13 #include <folly/Optional.h>
14 #include <folly/Range.h>
15 #include <folly/io/IOBuf.h>
16 #include <sodium.h>
17 
18 namespace fizz {
19 
24  public:
25  ~X25519KeyExchange() override = default;
26  void generateKeyPair() override;
27  std::unique_ptr<folly::IOBuf> getKeyShare() const override;
28  std::unique_ptr<folly::IOBuf> generateSharedSecret(
29  folly::ByteRange keyShare) const override;
30 
31  private:
32  using PrivKey = std::array<uint8_t, crypto_scalarmult_SCALARBYTES>;
33  using PubKey = std::array<uint8_t, crypto_scalarmult_BYTES>;
34 
37 };
38 } // namespace fizz
folly::Optional< PubKey > pubKey_
Definition: X25519.h:36
void generateKeyPair() override
Definition: X25519.cpp:20
folly::Optional< PrivKey > privKey_
Definition: X25519.h:35
std::array< uint8_t, crypto_scalarmult_BYTES > PubKey
Definition: X25519.h:33
std::unique_ptr< folly::IOBuf > getKeyShare() const override
Definition: X25519.cpp:32
Definition: Actions.h:16
std::array< uint8_t, crypto_scalarmult_SCALARBYTES > PrivKey
Definition: X25519.h:32
std::unique_ptr< folly::IOBuf > generateSharedSecret(folly::ByteRange keyShare) const override
Definition: X25519.cpp:39
~X25519KeyExchange() override=default