Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: extensions/common/cast/cast_cert_validator.h

Issue 1888913005: Add a hook to inject trusted Cast roots for testing purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | extensions/common/cast/cast_cert_validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/cast/cast_cert_validator.h
diff --git a/extensions/common/cast/cast_cert_validator.h b/extensions/common/cast/cast_cert_validator.h
index c435ebb8776f312edfb7c6bee440f028175c6d4f..e786a1982182ad00029ac740fa359865d8f8592e 100644
--- a/extensions/common/cast/cast_cert_validator.h
+++ b/extensions/common/cast/cast_cert_validator.h
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
#include "base/time/time.h"
+#include "net/cert/internal/verify_certificate_chain.h"
namespace extensions {
namespace api {
@@ -51,6 +52,20 @@ class CertVerificationContext {
DISALLOW_COPY_AND_ASSIGN(CertVerificationContext);
};
+// Helper function that creates and initializes a TrustAnchor struct given
+// arrays for the subject's DER and the SPKI's DER.
+template <size_t SubjectSize, size_t SpkiSize>
+net::TrustAnchor CreateTrustAnchor(const uint8_t (&subject)[SubjectSize],
eroman 2016/04/18 18:28:40 A more useful API is probably: void AddTrustAncho
ryanchung 2016/04/19 17:19:34 I'm thinking of undoing this API change and waitin
+ const uint8_t (&spki)[SpkiSize]) {
+ net::TrustAnchor anchor;
+ anchor.name = std::string(subject, subject + SubjectSize);
+ anchor.spki = std::string(spki, spki + SpkiSize);
+ return anchor;
+}
+
+// Creates a trust store with the two Cast roots.
+net::TrustStore CreateCastTrustStore();
+
// Verifies a cast device certficate given a chain of DER-encoded certificates.
//
// Inputs:
@@ -73,6 +88,19 @@ class CertVerificationContext {
// properties from the device certificate (Common Name).
// * |policy| is filled with an indication of the device certificate's policy
// (i.e. is it for audio-only devices or is it unrestricted?)
+// * |trust_store| is filled with the trusted CA certificate information
+bool VerifyDeviceCert(const std::vector<std::string>& certs,
+ const base::Time::Exploded& time,
+ scoped_ptr<CertVerificationContext>* context,
+ CastDeviceCertPolicy* policy,
+ net::TrustStore trust_store) WARN_UNUSED_RESULT;
eroman 2016/04/18 18:28:40 const net::TrustStore&
ryanchung 2016/04/19 17:19:34 Done.
+
+// Overloads VerifyDeviceCert(const std::vector<std::string>& certs,
eroman 2016/04/18 18:28:40 This comment could be simplified. // This is an o
ryanchung 2016/04/19 17:19:34 Done.
+// const base::Time::Exploded& time,
+// scoped_ptr<CertVerificationContext>* context,
+// CastDeviceCertPolicy* policy,
+// net::TrustStore trust_store)
+// Uses the default TrustStore from CreateCastTrustStore()
bool VerifyDeviceCert(const std::vector<std::string>& certs,
const base::Time::Exploded& time,
scoped_ptr<CertVerificationContext>* context,
« no previous file with comments | « no previous file | extensions/common/cast/cast_cert_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698