Chromium Code Reviews| 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 | |
| 16 namespace net { | |
| 17 class ParsedCertificate; | |
| 18 using ParsedCertificateList = std::vector<scoped_refptr<ParsedCertificate>>; | |
| 19 } // namespace net | |
| 20 | |
| 21 namespace cast_certificate { | |
| 22 | |
| 23 // This class represents the CRL information parsed from the binary proto. | |
| 24 class CastCRL { | |
| 25 public: | |
| 26 virtual ~CastCRL(){}; | |
|
eroman
2016/07/15 22:52:48
space?
Suggest running "git cl format"
ryanchung
2016/07/18 23:39:08
git cl format is removing the space. I don't know
eroman
2016/07/19 01:54:59
If that is what git cl does, then fine. No need to
| |
| 27 | |
| 28 // Verifies the revocation status of a cast device certificate given a chain | |
| 29 // of DER-encoded certificates. | |
|
eroman
2016/07/15 22:52:49
nit on wording: Not sure "DER-encoded" needs to be
ryanchung
2016/07/18 23:39:08
Done.
| |
| 30 // | |
| 31 // Inputs: | |
| 32 // * |certs| is the verified chain of DER-encoded certificates: | |
|
eroman
2016/07/15 22:52:49
same here -- can leave off the "DER-encoded"
ryanchung
2016/07/18 23:39:08
Done.
| |
| 33 // * |certs[0]| is the target certificate (i.e. the device certificate) | |
| 34 // * |certs[i]| is the certificate that issued certs[i-1] | |
| 35 // * |certs.back()| must be trusted anchor. | |
|
eroman
2016/07/15 22:52:49
nit: instead of "must be trusted anchor" how about
ryanchung
2016/07/18 23:39:08
Done.
| |
| 36 // | |
| 37 // * |time| is the UTC time to use for determining if the certificate | |
| 38 // is revoked. | |
|
eroman
2016/07/15 22:52:49
Can you mention the return value?
"Returns true i
ryanchung
2016/07/18 23:39:08
Done.
| |
| 39 virtual bool CheckRevocation(const net::ParsedCertificateList& certs, | |
| 40 const base::Time::Exploded& time) const = 0; | |
| 41 }; | |
| 42 | |
| 43 // Parses and verifies the CRL used to verify the revocation status of | |
| 44 // Cast device certificates. | |
| 45 // | |
| 46 // Inputs: | |
| 47 // * |crl_proto| is a serialized cast_certificate.CrlBundle proto. | |
| 48 // * |time| is the UTC time to use for determining if the CRL is valid. | |
| 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::Exploded& time); | |
| 53 | |
| 54 // Exposed only for testing, not for use in production code. | |
| 55 // | |
| 56 // Replaces trusted root certificates into the CastCRLTrustStore. | |
| 57 bool SetCRLTrustAnchorForTest(const std::string& cert) WARN_UNUSED_RESULT; | |
| 58 | |
| 59 } // namespace cast_certificate | |
| 60 | |
| 61 #endif // COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_ | |
| OLD | NEW |