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

Side by Side 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, 6 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 | Annotate | Revision Log
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_CHANNEL_ID_H_
6 #define NET_QUIC_CRYPTO_CHANNEL_ID_H_
7
8 #include <string>
9
10 #include "base/strings/string_piece.h"
11 #include "net/base/net_export.h"
12
13 namespace net {
14
15 // ChannelIDSigner is an abstract interface that implements signing by
16 // ChannelID keys.
17 class NET_EXPORT_PRIVATE ChannelIDSigner {
18 public:
19 virtual ~ChannelIDSigner() { }
20
21 // Sign signs |signed_data| using the ChannelID key for |hostname| and puts
22 // the serialized public key into |out_key| and the signature into
23 // |out_signature|. It returns true on success.
24 virtual bool Sign(const std::string& hostname,
25 base::StringPiece signed_data,
26 std::string* out_key,
27 std::string* out_signature) = 0;
28 };
29
30 // ChannelIDVerifier verifies ChannelID signatures.
31 class NET_EXPORT_PRIVATE ChannelIDVerifier {
32 public:
33 // kContextStr is prepended to the data to be signed in order to ensure that
34 // a ChannelID signature cannot be used in a different context. (The
35 // terminating NUL byte is inclued.)
36 static const char kContextStr[];
37 // kClientToServerStr follows kContextStr to specify that the ChannelID is
38 // being used in the client to server direction. (The terminating NUL byte is
39 // included.)
40 static const char kClientToServerStr[];
41
42 // Verify returns true iff |signature| is a valid signature of |signed_data|
43 // by |key|.
44 static bool Verify(base::StringPiece key,
45 base::StringPiece signed_data,
46 base::StringPiece signature);
47 };
48
49 } // namespace net
50
51 #endif // NET_QUIC_CRYPTO_CHANNEL_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698