OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/protocol/v2_authenticator.h" | 5 #include "remoting/protocol/v2_authenticator.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "crypto/rsa_private_key.h" | 9 #include "crypto/rsa_private_key.h" |
10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (state_ == ACCEPTED && !pending_messages_.empty()) | 73 if (state_ == ACCEPTED && !pending_messages_.empty()) |
74 return MESSAGE_READY; | 74 return MESSAGE_READY; |
75 return state_; | 75 return state_; |
76 } | 76 } |
77 | 77 |
78 Authenticator::RejectionReason V2Authenticator::rejection_reason() const { | 78 Authenticator::RejectionReason V2Authenticator::rejection_reason() const { |
79 DCHECK_EQ(state(), REJECTED); | 79 DCHECK_EQ(state(), REJECTED); |
80 return rejection_reason_; | 80 return rejection_reason_; |
81 } | 81 } |
82 | 82 |
83 void V2Authenticator::ProcessMessage(const buzz::XmlElement* message) { | 83 void V2Authenticator::ProcessMessage(const buzz::XmlElement* message, |
| 84 const base::Closure& resume_callback) { |
| 85 ProcessMessageInternal(message); |
| 86 resume_callback.Run(); |
| 87 } |
| 88 |
| 89 void V2Authenticator::ProcessMessageInternal(const buzz::XmlElement* message) { |
84 DCHECK_EQ(state(), WAITING_MESSAGE); | 90 DCHECK_EQ(state(), WAITING_MESSAGE); |
85 | 91 |
86 // Parse the certificate. | 92 // Parse the certificate. |
87 std::string base64_cert = message->TextNamed(kCertificateTag); | 93 std::string base64_cert = message->TextNamed(kCertificateTag); |
88 if (!base64_cert.empty()) { | 94 if (!base64_cert.empty()) { |
89 if (!base::Base64Decode(base64_cert, &remote_cert_)) { | 95 if (!base::Base64Decode(base64_cert, &remote_cert_)) { |
90 LOG(WARNING) << "Failed to decode certificate received from the peer."; | 96 LOG(WARNING) << "Failed to decode certificate received from the peer."; |
91 remote_cert_.clear(); | 97 remote_cert_.clear(); |
92 } | 98 } |
93 } | 99 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 remote_cert_, auth_key_).Pass()); | 200 remote_cert_, auth_key_).Pass()); |
195 } | 201 } |
196 } | 202 } |
197 | 203 |
198 bool V2Authenticator::is_host_side() const { | 204 bool V2Authenticator::is_host_side() const { |
199 return local_private_key_.get() != NULL; | 205 return local_private_key_.get() != NULL; |
200 } | 206 } |
201 | 207 |
202 } // namespace protocol | 208 } // namespace protocol |
203 } // namespace remoting | 209 } // namespace remoting |
OLD | NEW |