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

Unified Diff: net/quic/crypto/crypto_secret_boxer.h

Issue 213473003: This change introduces a way to tie source address token keys to specific QUIC server configs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix wtc's comments for patch set 5 Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/crypto/crypto_secret_boxer.cc » ('j') | net/quic/crypto/crypto_secret_boxer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/crypto_secret_boxer.h
diff --git a/net/quic/crypto/crypto_secret_boxer.h b/net/quic/crypto/crypto_secret_boxer.h
index ba9baf2bb2aad70d0eb413c68a286d345ca48ba1..6deb7718157a9d2065ba3bd82425538e5e672b9a 100644
--- a/net/quic/crypto/crypto_secret_boxer.h
+++ b/net/quic/crypto/crypto_secret_boxer.h
@@ -7,8 +7,11 @@
#include <string>
+#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
#include "net/base/net_export.h"
+#include "net/quic/crypto/quic_decrypter.h"
+#include "net/quic/crypto/quic_encrypter.h"
namespace net {
@@ -19,12 +22,17 @@ class QuicRandom;
// thread-safe.
class NET_EXPORT_PRIVATE CryptoSecretBoxer {
public:
+ // Initializes |encrypter_| and |decrypter_| data members.
+ CryptoSecretBoxer();
+ ~CryptoSecretBoxer();
+
// GetKeySize returns the number of bytes in a key.
static size_t GetKeySize();
// SetKey sets the key for this object. This must be done before |Box| or
- // |Unbox| are called. |key| must be |GetKeySize()| bytes long.
- void SetKey(base::StringPiece key);
+ // |Unbox| are called. |key| must be |GetKeySize()| bytes long. Returns false
+ // if |encrypter_| or |decrypter_|'s SetKey method fails.
+ bool SetKey(base::StringPiece key);
// Box encrypts |plaintext| using a random nonce generated from |rand| and
// returns the resulting ciphertext. Since an authenticator and nonce are
@@ -41,7 +49,10 @@ class NET_EXPORT_PRIVATE CryptoSecretBoxer {
base::StringPiece* out) const;
private:
- std::string key_;
+ scoped_ptr<QuicEncrypter> encrypter_;
+ scoped_ptr<QuicDecrypter> decrypter_;
+
+ DISALLOW_COPY_AND_ASSIGN(CryptoSecretBoxer);
};
} // namespace net
« no previous file with comments | « no previous file | net/quic/crypto/crypto_secret_boxer.cc » ('j') | net/quic/crypto/crypto_secret_boxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698