| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_ |
| 6 #define COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time/time.h" |
| 15 #include "net/cert/internal/parsed_certificate.h" |
| 16 |
| 17 namespace cast_certificate { |
| 18 |
| 19 // This class represents the CRL information parsed from the binary proto. |
| 20 class CastCRL { |
| 21 public: |
| 22 virtual ~CastCRL(){}; |
| 23 |
| 24 // Verifies the revocation status of a cast device certificate given a chain |
| 25 // of X.509 certificates. |
| 26 // |
| 27 // Inputs: |
| 28 // * |certs| is the verified chain of X.509 certificates: |
| 29 // * |certs[0]| is the target certificate (i.e. the device certificate). |
| 30 // * |certs[i]| is the certificate that issued certs[i-1]. |
| 31 // * |certs.back()| is assumed to be a trusted root. |
| 32 // |
| 33 // * |time| is the unix timestamp to use for determining if the certificate |
| 34 // is revoked. |
| 35 // |
| 36 // Output: |
| 37 // Returns true if no certificate in the chain was revoked. |
| 38 virtual bool CheckRevocation(const net::ParsedCertificateList& certs, |
| 39 const base::Time& time) const = 0; |
| 40 }; |
| 41 |
| 42 // Parses and verifies the CRL used to verify the revocation status of |
| 43 // Cast device certificates. |
| 44 // |
| 45 // Inputs: |
| 46 // * |crl_proto| is a serialized cast_certificate.CrlBundle proto. |
| 47 // * |time| is the unix timestamp to use for determining if the CRL is valid. |
| 48 // |
| 49 // Output: |
| 50 // Returns the CRL object if success, nullptr otherwise. |
| 51 std::unique_ptr<CastCRL> ParseAndVerifyCRL(const std::string& crl_proto, |
| 52 const base::Time& time); |
| 53 |
| 54 // Exposed only for testing, not for use in production code. |
| 55 // |
| 56 // Replaces trusted root certificates into the CastCRLTrustStore. |
| 57 // |
| 58 // Output: |
| 59 // Returns true if successful, false if nothing is changed. |
| 60 bool SetCRLTrustAnchorForTest(const std::string& cert) WARN_UNUSED_RESULT; |
| 61 |
| 62 } // namespace cast_certificate |
| 63 |
| 64 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_ |
| OLD | NEW |