net: rework the EV metadata
(Reland of r126641, which was reverted in r126646)
This is split off from https://chromiumcodereview.appspot.com/9663017/ (adding
OCSP tests) and the primary motivation is to add the ability for unittests to add
EV policies.
Along the way:
* I switched the policy strings to be inline, which saves a bunch of
relocations.
* I eliminated the duplicated policy strings and removed the data structures
duplicating the static data on Windows. The functions that Windows needs
can be implemented with a linear sweep over the static data.
BUG=none
TEST=net_unittests
Review URL: https://chromiumcodereview.appspot.com/9691015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126655 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/base/cert_test_util.h b/net/base/cert_test_util.h
index 4078accd..15ceb58 100644
--- a/net/base/cert_test_util.h
+++ b/net/base/cert_test_util.h
@@ -9,12 +9,15 @@
#include <string>
#include "base/memory/ref_counted.h"
+#include "net/base/x509_cert_types.h"
#include "net/base/x509_certificate.h"
class FilePath;
namespace net {
+class EVRootCAMetadata;
+
// Returns a FilePath object representing the src/net/data/ssl/certificates
// directory in the source tree.
FilePath GetTestCertsDirectory();
@@ -30,6 +33,23 @@
scoped_refptr<X509Certificate> ImportCertFromFile(const FilePath& certs_dir,
const std::string& cert_file);
+// ScopedTestEVPolicy causes certificates marked with |policy|, issued from a
+// root with the given fingerprint, to be treated as EV. |policy| is expressed
+// as a string of dotted numbers: i.e. "1.2.3.4".
+// This should only be used in unittests as adding a CA twice causes a CHECK
+// failure.
+class ScopedTestEVPolicy {
+ public:
+ ScopedTestEVPolicy(EVRootCAMetadata* ev_root_ca_metadata,
+ const SHA1Fingerprint& fingerprint,
+ const char* policy);
+ ~ScopedTestEVPolicy();
+
+ private:
+ SHA1Fingerprint fingerprint_;
+ EVRootCAMetadata* const ev_root_ca_metadata_;
+};
+
} // namespace net
#endif // NET_BASE_CERT_TEST_UTIL_H_