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

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

Issue 15937012: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small bug fixes Created 7 years, 7 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
Index: net/quic/crypto/channel_id.h
diff --git a/net/quic/crypto/channel_id.h b/net/quic/crypto/channel_id.h
new file mode 100644
index 0000000000000000000000000000000000000000..872fece04f81902db65e39a52a04c49a0e282fdd
--- /dev/null
+++ b/net/quic/crypto/channel_id.h
@@ -0,0 +1,51 @@
+// 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 NET_QUIC_CRYPTO_CHANNEL_ID_H_
+#define NET_QUIC_CRYPTO_CHANNEL_ID_H_
+
+#include <string>
+
+#include "base/strings/string_piece.h"
+#include "net/base/net_export.h"
+
+namespace net {
+
+// ChannelIDSigner is an abstract interface that implements signing by
+// ChannelID keys.
+class NET_EXPORT_PRIVATE ChannelIDSigner {
+ public:
+ virtual ~ChannelIDSigner() { }
+
+ // Sign signs |signed_data| using the ChannelID key for |hostname| and puts
+ // the serialized public key into |out_key| and the signature into
+ // |out_signature|. It returns true on success.
+ virtual bool Sign(const std::string& hostname,
+ base::StringPiece signed_data,
+ std::string* out_key,
+ std::string* out_signature) = 0;
+};
+
+// ChannelIDVerifier verifies ChannelID signatures.
+class NET_EXPORT_PRIVATE ChannelIDVerifier {
+ public:
+ // kContextStr is prepended to the data to be signed in order to ensure that
+ // a ChannelID signature cannot be used in a different context. (The
+ // terminating NUL byte is inclued.)
+ static const char kContextStr[];
+ // kClientToServerStr follows kContextStr to specify that the ChannelID is
+ // being used in the client to server direction. (The terminating NUL byte is
+ // included.)
+ static const char kClientToServerStr[];
+
+ // Verify returns true iff |signature| is a valid signature of |signed_data|
+ // by |key|.
+ static bool Verify(base::StringPiece key,
+ base::StringPiece signed_data,
+ base::StringPiece signature);
+};
+
+} // namespace net
+
+#endif // NET_QUIC_CRYPTO_CHANNEL_ID_H_

Powered by Google App Engine
This is Rietveld 408576698