OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "components/cast_certificate/cast_crl.h" | 5 #include "components/cast_certificate/cast_crl.h" |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 } | 311 } |
312 } | 312 } |
313 } | 313 } |
314 } | 314 } |
315 } | 315 } |
316 return true; | 316 return true; |
317 } | 317 } |
318 | 318 |
319 // Parses and verifies the CRL used to verify the revocation status of | 319 // Parses and verifies the CRL used to verify the revocation status of |
320 // Cast device certificates. | 320 // Cast device certificates. |
321 std::unique_ptr<CastCRL> ParseAndVerifyCRL(const std::string& crl_proto, | 321 std::unique_ptr<CastCRL> ParseAndVerifyCRL(const std::string& crl_proto, |
eroman
2016/09/22 22:02:51
Same thing here -- how about just moving this into
ryanchung
2016/09/22 22:43:35
Done.
| |
322 const base::Time& time, | 322 const base::Time& time, |
323 net::TrustStore* trust_store) { | 323 net::TrustStore* trust_store) { |
324 if (!trust_store) | |
325 return nullptr; | |
326 | |
324 CrlBundle crl_bundle; | 327 CrlBundle crl_bundle; |
325 if (!crl_bundle.ParseFromString(crl_proto)) { | 328 if (!crl_bundle.ParseFromString(crl_proto)) { |
326 LOG(ERROR) << "CRL - Binary could not be parsed."; | 329 LOG(ERROR) << "CRL - Binary could not be parsed."; |
327 return nullptr; | 330 return nullptr; |
328 } | 331 } |
329 for (auto const& crl : crl_bundle.crls()) { | 332 for (auto const& crl : crl_bundle.crls()) { |
330 TbsCrl tbs_crl; | 333 TbsCrl tbs_crl; |
331 if (!tbs_crl.ParseFromString(crl.tbs_crl())) { | 334 if (!tbs_crl.ParseFromString(crl.tbs_crl())) { |
332 LOG(WARNING) << "Binary TBS CRL could not be parsed."; | 335 LOG(WARNING) << "Binary TBS CRL could not be parsed."; |
333 continue; | 336 continue; |
(...skipping 12 matching lines...) Expand all Loading... | |
346 return nullptr; | 349 return nullptr; |
347 } | 350 } |
348 | 351 |
349 } // namespace | 352 } // namespace |
350 | 353 |
351 std::unique_ptr<CastCRL> ParseAndVerifyCRL(const std::string& crl_proto, | 354 std::unique_ptr<CastCRL> ParseAndVerifyCRL(const std::string& crl_proto, |
352 const base::Time& time) { | 355 const base::Time& time) { |
353 return ParseAndVerifyCRL(crl_proto, time, &CastCRLTrustStore::Get()); | 356 return ParseAndVerifyCRL(crl_proto, time, &CastCRLTrustStore::Get()); |
354 } | 357 } |
355 | 358 |
356 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest( | 359 std::unique_ptr<CastCRL> ParseAndVerifyCRLUsingCustomTrustStore( |
357 const std::string& crl_proto, | 360 const std::string& crl_proto, |
358 const base::Time& time, | 361 const base::Time& time, |
359 net::TrustStore* trust_store) { | 362 net::TrustStore* trust_store) { |
363 if (!trust_store) | |
364 return ParseAndVerifyCRL(crl_proto, time); | |
360 return ParseAndVerifyCRL(crl_proto, time, trust_store); | 365 return ParseAndVerifyCRL(crl_proto, time, trust_store); |
361 } | 366 } |
362 | 367 |
363 } // namespace cast_certificate | 368 } // namespace cast_certificate |
OLD | NEW |