| 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 COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ | 5 #ifndef COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ |
| 6 #define COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ | 6 #define COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // properties from the device certificate (Common Name). | 92 // properties from the device certificate (Common Name). |
| 93 // * |policy| is filled with an indication of the device certificate's policy | 93 // * |policy| is filled with an indication of the device certificate's policy |
| 94 // (i.e. is it for audio-only devices or is it unrestricted?) | 94 // (i.e. is it for audio-only devices or is it unrestricted?) |
| 95 bool VerifyDeviceCert(const std::vector<std::string>& certs, | 95 bool VerifyDeviceCert(const std::vector<std::string>& certs, |
| 96 const base::Time& time, | 96 const base::Time& time, |
| 97 std::unique_ptr<CertVerificationContext>* context, | 97 std::unique_ptr<CertVerificationContext>* context, |
| 98 CastDeviceCertPolicy* policy, | 98 CastDeviceCertPolicy* policy, |
| 99 const CastCRL* crl, | 99 const CastCRL* crl, |
| 100 CRLPolicy crl_policy) WARN_UNUSED_RESULT; | 100 CRLPolicy crl_policy) WARN_UNUSED_RESULT; |
| 101 | 101 |
| 102 // Exposed only for testing, not for use in production code. | 102 // This is an overloaded version of VerifyDeviceCert that allows |
| 103 // the input of a custom TrustStore. If |trust_store| is null, then the default |
| 104 // is used. |
| 103 // | 105 // |
| 104 // This is an overloaded version of VerifyDeviceCert that allows | 106 // For production use pass |trust_store| as nullptr to use the production trust |
| 105 // the input of a custom TrustStore. | 107 // store. |
| 106 bool VerifyDeviceCertForTest(const std::vector<std::string>& certs, | 108 bool VerifyDeviceCertUsingCustomTrustStore( |
| 107 const base::Time& time, | 109 const std::vector<std::string>& certs, |
| 108 std::unique_ptr<CertVerificationContext>* context, | 110 const base::Time& time, |
| 109 CastDeviceCertPolicy* policy, | 111 std::unique_ptr<CertVerificationContext>* context, |
| 110 const CastCRL* crl, | 112 CastDeviceCertPolicy* policy, |
| 111 CRLPolicy crl_policy, | 113 const CastCRL* crl, |
| 112 net::TrustStore* trust_store) WARN_UNUSED_RESULT; | 114 CRLPolicy crl_policy, |
| 115 net::TrustStore* trust_store) WARN_UNUSED_RESULT; |
| 113 | 116 |
| 114 // Exposed only for unit-tests, not for use in production code. | 117 // Exposed only for unit-tests, not for use in production code. |
| 115 // Production code would get a context from VerifyDeviceCert(). | 118 // Production code would get a context from VerifyDeviceCert(). |
| 116 // | 119 // |
| 117 // Constructs a VerificationContext that uses the provided public key. | 120 // Constructs a VerificationContext that uses the provided public key. |
| 118 // The common name will be hardcoded to some test value. | 121 // The common name will be hardcoded to some test value. |
| 119 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( | 122 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( |
| 120 const base::StringPiece& spki); | 123 const base::StringPiece& spki); |
| 121 | 124 |
| 122 } // namespace cast_certificate | 125 } // namespace cast_certificate |
| 123 | 126 |
| 124 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ | 127 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ |
| OLD | NEW |