| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_auth_util.h" | 5 #include "extensions/browser/api/cast_channel/cast_auth_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "components/cast_certificate/cast_cert_validator.h" |
| 13 #include "extensions/browser/api/cast_channel/cast_message_util.h" | 14 #include "extensions/browser/api/cast_channel/cast_message_util.h" |
| 14 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 15 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
| 15 #include "extensions/common/cast/cast_cert_validator.h" | |
| 16 #include "net/cert/x509_certificate.h" | 16 #include "net/cert/x509_certificate.h" |
| 17 #include "net/der/parse_values.h" | 17 #include "net/der/parse_values.h" |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 namespace api { | 20 namespace api { |
| 21 namespace cast_channel { | 21 namespace cast_channel { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const char* const kParseErrorPrefix = "Failed to parse auth message: "; | 24 const char* const kParseErrorPrefix = "Failed to parse auth message: "; |
| 25 | 25 |
| 26 // The maximum number of days a cert can live for. | 26 // The maximum number of days a cert can live for. |
| 27 const int kMaxSelfSignedCertLifetimeInDays = 4; | 27 const int kMaxSelfSignedCertLifetimeInDays = 4; |
| 28 | 28 |
| 29 namespace cast_crypto = ::extensions::api::cast_crypto; | 29 namespace cast_crypto = ::cast_certificate; |
| 30 | 30 |
| 31 // Extracts an embedded DeviceAuthMessage payload from an auth challenge reply | 31 // Extracts an embedded DeviceAuthMessage payload from an auth challenge reply |
| 32 // message. | 32 // message. |
| 33 AuthResult ParseAuthMessage(const CastMessage& challenge_reply, | 33 AuthResult ParseAuthMessage(const CastMessage& challenge_reply, |
| 34 DeviceAuthMessage* auth_message) { | 34 DeviceAuthMessage* auth_message) { |
| 35 if (challenge_reply.payload_type() != CastMessage_PayloadType_BINARY) { | 35 if (challenge_reply.payload_type() != CastMessage_PayloadType_BINARY) { |
| 36 return AuthResult::CreateWithParseError( | 36 return AuthResult::CreateWithParseError( |
| 37 "Wrong payload type in challenge reply", | 37 "Wrong payload type in challenge reply", |
| 38 AuthResult::ERROR_WRONG_PAYLOAD_TYPE); | 38 AuthResult::ERROR_WRONG_PAYLOAD_TYPE); |
| 39 } | 39 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 success.channel_policies = AuthResult::POLICY_NONE; | 176 success.channel_policies = AuthResult::POLICY_NONE; |
| 177 break; | 177 break; |
| 178 } | 178 } |
| 179 | 179 |
| 180 return success; | 180 return success; |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace cast_channel | 183 } // namespace cast_channel |
| 184 } // namespace api | 184 } // namespace api |
| 185 } // namespace extensions | 185 } // namespace extensions |
| OLD | NEW |