Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 "remoting/protocol/authenticator.h" | |
| 9 | |
| 10 namespace remoting { | |
| 11 | |
| 12 class RsaKeyPair; | |
| 13 | |
| 14 namespace protocol { | |
| 15 | |
| 16 class V2Authenticator; | |
| 17 class PairingRegistry; | |
| 18 | |
| 19 // PairingClientAuthenticator builds on top of V2Authenticator to add | |
| 20 // support for PIN-less authentication via device pairing: | |
| 21 // | |
| 22 // * If a client device is already paired, it includes a client id in | |
| 23 // the initial authentication message. | |
| 24 // * If the host recognizes the id, it looks up the corresponding | |
| 25 // shared secret and the rest of the protocol is host-initiated | |
| 26 // SPAKE with HMAC_SHA256. | |
| 27 // * If it does not recognize the id, it sends an error message to | |
| 28 // the client, which will prompt the user for a PIN to use for | |
| 29 // authentication instead. In this case, the rest of the procotol | |
| 30 // is client-initiated SPAKE with HMAC_SHA256. | |
| 31 // | |
| 32 // If a client device is not already paired, but supports pairing, it | |
| 33 // sends an empty initial authentication message. In this case, the | |
| 34 // authenticator behaves exactly like the V2Authenticator with | |
|
rmsousa
2013/05/16 00:46:25
Please clarify who sends the first SPAKE message i
| |
| 35 // HMAC_SHA256--only the protocol type differs, which the client uses | |
| 36 // to detect that pairing should be offered to the user. | |
| 37 class PairingHostAuthenticator : public Authenticator { | |
| 38 public: | |
| 39 PairingHostAuthenticator( | |
| 40 scoped_refptr<PairingRegistry> pairing_registry, | |
| 41 const std::string& local_cert, | |
| 42 scoped_refptr<RsaKeyPair> key_pair, | |
| 43 const std::string& shared_secret, | |
| 44 State initial_state); | |
| 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(State initial_state); | |
| 58 | |
| 59 scoped_refptr<PairingRegistry> pairing_registry_; | |
| 60 std::string local_cert_; | |
| 61 scoped_refptr<RsaKeyPair> key_pair_; | |
| 62 const std::string& shared_secret_; | |
| 63 scoped_ptr<Authenticator> v2_authenticator_; | |
| 64 std::string error_message_; | |
| 65 bool protocol_error_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator); | |
| 68 }; | |
| 69 | |
| 70 } // namespace protocol | |
| 71 } // namespace remoting | |
| 72 | |
| 73 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_ | |
| OLD | NEW |