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

Side by Side Diff: remoting/protocol/pairing_host_authenticator.h

Issue 14793021: PairingAuthenticator implementation and plumbing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rmsousa's comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 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 REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "remoting/protocol/authenticator.h"
10
11 namespace remoting {
12
13 class RsaKeyPair;
14
15 namespace protocol {
16
17 class V2Authenticator;
18 class PairingRegistry;
19
20 // PairingHostAuthenticator builds on top of V2Authenticator to add
21 // support for PIN-less authentication via device pairing:
22 //
23 // * If a client device is already paired, it includes a client id in
Wez 2013/05/18 20:08:36 nit: See comment in client imp re capitalization.
Jamie 2013/05/21 01:24:34 Done.
24 // the initial authentication message.
25 // * If the host recognizes the id, it looks up the corresponding
26 // paired secret and initiates a SPAKE with HMAC_SHA256.
27 // * If it does not recognize the id, it initiates a SPAKE exchange
28 // with HMAC_SHA256 using the PIN as the shared secret. The initial
29 // message of this exchange includes an an error message, which
30 // informs the client that the PIN-less connection failed and causes
31 // it to prompt the user for a PIN to use for authentication
32 // instead.
33 //
34 // If a client device is not already paired, but supports pairing, then
35 // the V2Authenticator is used instead of this class. Only the method name
36 // differs, which the client uses to determine that pairing should be offered
37 // to the user.
38 class PairingHostAuthenticator : public Authenticator {
39 public:
40 PairingHostAuthenticator(
41 scoped_refptr<PairingRegistry> pairing_registry,
42 const std::string& local_cert,
43 scoped_refptr<RsaKeyPair> key_pair,
44 const std::string& pin);
45 virtual ~PairingHostAuthenticator() {}
46
47 // Authenticator interface.
48 virtual State state() const OVERRIDE;
49 virtual RejectionReason rejection_reason() const OVERRIDE;
50 virtual void ProcessMessage(const buzz::XmlElement* message,
51 const base::Closure& resume_callback) OVERRIDE;
52 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
53 virtual scoped_ptr<ChannelAuthenticator>
54 CreateChannelAuthenticator() const OVERRIDE;
55
56 private:
57 void CreateV2AuthenticatorWithPIN();
58 void CheckForFailedSpakeExchange(const base::Closure& resume_callback);
Wez 2013/05/18 20:08:36 nit: Comments for these members, please.
Jamie 2013/05/21 01:24:34 Done in the base class for the former. The latter
Wez 2013/05/22 00:51:45 Style guide says otherwise. ;) But yeah, you can p
Jamie 2013/05/22 01:16:46 Done.
59
60 scoped_refptr<PairingRegistry> pairing_registry_;
Wez 2013/05/18 20:08:36 nit: At least a block comment introducing these me
Jamie 2013/05/21 01:24:34 Done.
61 std::string local_cert_;
62 scoped_refptr<RsaKeyPair> key_pair_;
63 const std::string& pin_;
64 scoped_ptr<Authenticator> v2_authenticator_;
65 std::string error_message_;
66 bool protocol_error_;
Wez 2013/05/18 20:08:36 nit: This name sounds like it stores an error, rat
Jamie 2013/05/21 01:24:34 error_message doesn't indicate a fatal error, just
67 bool using_paired_secret_;
68 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_;
Wez 2013/05/18 20:08:36 nit: Blank line before this, please.
Jamie 2013/05/21 01:24:34 Done.
69
70 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator);
71 };
72
73 } // namespace protocol
74 } // namespace remoting
75
76 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698