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 #ifndef EXTENSIONS_COMMON_CAST_CAST_CERT_VALIDATOR_H_ | 5 #ifndef EXTENSIONS_COMMON_CAST_CAST_CERT_VALIDATOR_H_ |
6 #define EXTENSIONS_COMMON_CAST_CAST_CERT_VALIDATOR_H_ | 6 #define EXTENSIONS_COMMON_CAST_CAST_CERT_VALIDATOR_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 namespace api { | 18 namespace api { |
19 namespace cast_crypto { | 19 namespace cast_crypto { |
20 | 20 |
21 // Describes the policy for a Device certificate. | 21 // Describes the policy for a Device certificate. |
22 enum class CastDeviceCertPolicy { | 22 enum class CastDeviceCertPolicy { |
23 // The device certificate is unrestricted. | 23 // The device certificate is unrestricted. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Returns true on success, false on failure. On success the output | 68 // Returns true on success, false on failure. On success the output |
69 // parameters are filled with more details: | 69 // parameters are filled with more details: |
70 // | 70 // |
71 // * |context| is filled with an object that can be used to verify signatures | 71 // * |context| is filled with an object that can be used to verify signatures |
72 // using the device certificate's public key, as well as to extract other | 72 // using the device certificate's public key, as well as to extract other |
73 // properties from the device certificate (Common Name). | 73 // properties from the device certificate (Common Name). |
74 // * |policy| is filled with an indication of the device certificate's policy | 74 // * |policy| is filled with an indication of the device certificate's policy |
75 // (i.e. is it for audio-only devices or is it unrestricted?) | 75 // (i.e. is it for audio-only devices or is it unrestricted?) |
76 bool VerifyDeviceCert(const std::vector<std::string>& certs, | 76 bool VerifyDeviceCert(const std::vector<std::string>& certs, |
77 const base::Time::Exploded& time, | 77 const base::Time::Exploded& time, |
78 scoped_ptr<CertVerificationContext>* context, | 78 std::unique_ptr<CertVerificationContext>* context, |
79 CastDeviceCertPolicy* policy) WARN_UNUSED_RESULT; | 79 CastDeviceCertPolicy* policy) WARN_UNUSED_RESULT; |
80 | 80 |
81 // Exposed only for unit-tests, not for use in production code. | 81 // Exposed only for unit-tests, not for use in production code. |
82 // Production code would get a context from VerifyDeviceCert(). | 82 // Production code would get a context from VerifyDeviceCert(). |
83 // | 83 // |
84 // Constructs a VerificationContext that uses the provided public key. | 84 // Constructs a VerificationContext that uses the provided public key. |
85 // The common name will be hardcoded to some test value. | 85 // The common name will be hardcoded to some test value. |
86 scoped_ptr<CertVerificationContext> CertVerificationContextImplForTest( | 86 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( |
87 const base::StringPiece& spki); | 87 const base::StringPiece& spki); |
88 | 88 |
89 | |
90 } // namespace cast_crypto | 89 } // namespace cast_crypto |
91 } // namespace api | 90 } // namespace api |
92 } // namespace extensions | 91 } // namespace extensions |
93 | 92 |
94 #endif // EXTENSIONS_COMMON_CAST_CAST_CERT_VALIDATOR_H_ | 93 #endif // EXTENSIONS_COMMON_CAST_CAST_CERT_VALIDATOR_H_ |
OLD | NEW |