| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // * |context| is filled with an object that can be used to verify signatures | 69 // * |context| is filled with an object that can be used to verify signatures |
| 70 // using the device certificate's public key, as well as to extract other | 70 // using the device certificate's public key, as well as to extract other |
| 71 // properties from the device certificate (Common Name). | 71 // properties from the device certificate (Common Name). |
| 72 // * |policy| is filled with an indication of the device certificate's policy | 72 // * |policy| is filled with an indication of the device certificate's policy |
| 73 // (i.e. is it for audio-only devices or is it unrestricted?) | 73 // (i.e. is it for audio-only devices or is it unrestricted?) |
| 74 bool VerifyDeviceCert(const std::vector<std::string>& certs, | 74 bool VerifyDeviceCert(const std::vector<std::string>& certs, |
| 75 const base::Time::Exploded& time, | 75 const base::Time::Exploded& time, |
| 76 std::unique_ptr<CertVerificationContext>* context, | 76 std::unique_ptr<CertVerificationContext>* context, |
| 77 CastDeviceCertPolicy* policy) WARN_UNUSED_RESULT; | 77 CastDeviceCertPolicy* policy) WARN_UNUSED_RESULT; |
| 78 | 78 |
| 79 // Returns the DER-encoded certificate of the trust anchor with the name |
| 80 // provided. |
| 81 // |
| 82 // Input: |
| 83 // |
| 84 // * |name| is the DER-encoded name of the trust anchor's certificate |
| 85 // |
| 86 // Output: |
| 87 // |
| 88 // Returns the DER-encoded certificate of the trust anchor if the name of the |
| 89 // certificate matches the provided name. An empty string is returned if there |
| 90 // is no match. |
| 91 const std::string FindCastTrustAnchorByName(const std::string& name); |
| 92 |
| 79 // Exposed only for unit-tests, not for use in production code. | 93 // Exposed only for unit-tests, not for use in production code. |
| 80 // Production code would get a context from VerifyDeviceCert(). | 94 // Production code would get a context from VerifyDeviceCert(). |
| 81 // | 95 // |
| 82 // Constructs a VerificationContext that uses the provided public key. | 96 // Constructs a VerificationContext that uses the provided public key. |
| 83 // The common name will be hardcoded to some test value. | 97 // The common name will be hardcoded to some test value. |
| 84 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( | 98 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( |
| 85 const base::StringPiece& spki); | 99 const base::StringPiece& spki); |
| 86 | 100 |
| 87 // Exposed only for testing, not for use in production code. | 101 // Exposed only for testing, not for use in production code. |
| 88 // | 102 // |
| 89 // Injects trusted root certificates into the CastTrustStore. | 103 // Injects trusted root certificates into the CastTrustStore. |
| 90 // |data| must remain valid and not be mutated throughout the lifetime of | 104 // |data| must remain valid and not be mutated throughout the lifetime of |
| 91 // the program. | 105 // the program. |
| 92 // Warning: Using this function concurrently with VerifyDeviceCert() | 106 // Warning: Using this function concurrently with VerifyDeviceCert() |
| 93 // is not thread safe. | 107 // is not thread safe. |
| 94 bool AddTrustAnchorForTest(const uint8_t* data, | 108 bool AddTrustAnchorForTest(const uint8_t* data, |
| 95 size_t length) WARN_UNUSED_RESULT; | 109 size_t length) WARN_UNUSED_RESULT; |
| 96 | 110 |
| 97 } // namespace cast_certificate | 111 } // namespace cast_certificate |
| 98 | 112 |
| 99 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ | 113 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CERT_VALIDATOR_H_ |
| OLD | NEW |