| 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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "extensions/browser/api/cast_channel/cast_message_util.h" | 12 #include "extensions/browser/api/cast_channel/cast_message_util.h" |
| 13 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 13 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
| 14 #include "extensions/common/cast/cast_cert_validator.h" | 14 #include "extensions/common/cast/cast_cert_validator.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 namespace core_api { | 17 namespace api { |
| 18 namespace cast_channel { | 18 namespace cast_channel { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const char* const kParseErrorPrefix = "Failed to parse auth message: "; | 21 const char* const kParseErrorPrefix = "Failed to parse auth message: "; |
| 22 | 22 |
| 23 const unsigned char kAudioOnlyPolicy[] = | 23 const unsigned char kAudioOnlyPolicy[] = |
| 24 {0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xD6, 0x79, 0x02, 0x05, 0x02}; | 24 {0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xD6, 0x79, 0x02, 0x05, 0x02}; |
| 25 | 25 |
| 26 namespace cast_crypto = ::extensions::core_api::cast_crypto; | 26 namespace cast_crypto = ::extensions::api::cast_crypto; |
| 27 | 27 |
| 28 // Extracts an embedded DeviceAuthMessage payload from an auth challenge reply | 28 // Extracts an embedded DeviceAuthMessage payload from an auth challenge reply |
| 29 // message. | 29 // message. |
| 30 AuthResult ParseAuthMessage(const CastMessage& challenge_reply, | 30 AuthResult ParseAuthMessage(const CastMessage& challenge_reply, |
| 31 DeviceAuthMessage* auth_message) { | 31 DeviceAuthMessage* auth_message) { |
| 32 if (challenge_reply.payload_type() != CastMessage_PayloadType_BINARY) { | 32 if (challenge_reply.payload_type() != CastMessage_PayloadType_BINARY) { |
| 33 return AuthResult::CreateWithParseError( | 33 return AuthResult::CreateWithParseError( |
| 34 "Wrong payload type in challenge reply", | 34 "Wrong payload type in challenge reply", |
| 35 AuthResult::ERROR_WRONG_PAYLOAD_TYPE); | 35 AuthResult::ERROR_WRONG_PAYLOAD_TYPE); |
| 36 } | 36 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 &verification_context); | 167 &verification_context); |
| 168 | 168 |
| 169 if (ret.Success()) | 169 if (ret.Success()) |
| 170 ret = verification_context->VerifySignatureOverData(response.signature(), | 170 ret = verification_context->VerifySignatureOverData(response.signature(), |
| 171 peer_cert); | 171 peer_cert); |
| 172 | 172 |
| 173 return TranslateVerificationResult(ret); | 173 return TranslateVerificationResult(ret); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace cast_channel | 176 } // namespace cast_channel |
| 177 } // namespace core_api | 177 } // namespace api |
| 178 } // namespace extensions | 178 } // namespace extensions |
| OLD | NEW |