Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: net/quic/crypto/curve25519_key_exchange.h

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/crypto/crypto_utils_test.cc ('k') | net/quic/crypto/curve25519_key_exchange.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_CURVE25519_KEY_EXCHANGE_H_
6 #define NET_QUIC_CRYPTO_CURVE25519_KEY_EXCHANGE_H_
7
8 #include <stdint.h>
9
10 #include <string>
11
12 #include "base/compiler_specific.h"
13 #include "base/strings/string_piece.h"
14 #include "net/base/net_export.h"
15 #include "net/quic/crypto/key_exchange.h"
16
17 namespace net {
18
19 class QuicRandom;
20
21 // Curve25519KeyExchange implements a KeyExchange using elliptic-curve
22 // Diffie-Hellman on curve25519. See http://cr.yp.to/ecdh.html
23 class NET_EXPORT_PRIVATE Curve25519KeyExchange : public KeyExchange {
24 public:
25 ~Curve25519KeyExchange() override;
26
27 // New creates a new object from a private key. If the private key is
28 // invalid, nullptr is returned.
29 static Curve25519KeyExchange* New(base::StringPiece private_key);
30
31 // NewPrivateKey returns a private key, generated from |rand|, suitable for
32 // passing to |New|.
33 static std::string NewPrivateKey(QuicRandom* rand);
34
35 // KeyExchange interface.
36 KeyExchange* NewKeyPair(QuicRandom* rand) const override;
37 bool CalculateSharedKey(base::StringPiece peer_public_value,
38 std::string* shared_key) const override;
39 base::StringPiece public_value() const override;
40 QuicTag tag() const override;
41
42 private:
43 Curve25519KeyExchange();
44
45 uint8_t private_key_[32];
46 uint8_t public_key_[32];
47 };
48
49 } // namespace net
50
51 #endif // NET_QUIC_CRYPTO_CURVE25519_KEY_EXCHANGE_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/crypto_utils_test.cc ('k') | net/quic/crypto/curve25519_key_exchange.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698