diff options
Diffstat (limited to 'net/base/ev_root_ca_metadata.h')
-rw-r--r-- | net/base/ev_root_ca_metadata.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/net/base/ev_root_ca_metadata.h b/net/base/ev_root_ca_metadata.h index 7904039..5b12337 100644 --- a/net/base/ev_root_ca_metadata.h +++ b/net/base/ev_root_ca_metadata.h @@ -5,9 +5,15 @@ #ifndef NET_BASE_EV_ROOT_CA_METADATA_H_ #define NET_BASE_EV_ROOT_CA_METADATA_H_ +#include "build/build_config.h" + +#if defined(OS_LINUX) +#include <secoidt.h> +#endif + #include <map> +#include <vector> -#include "base/scoped_ptr.h" #include "net/base/x509_certificate.h" template <typename T> @@ -19,15 +25,21 @@ namespace net { // extended-validation (EV) certificates. class EVRootCAMetadata { public: +#if defined(OS_LINUX) + typedef SECOidTag PolicyOID; +#else + typedef const char* PolicyOID; +#endif + static EVRootCAMetadata* GetInstance(); // If the root CA cert has an EV policy OID, returns true and stores the // policy OID in *policy_oid. Otherwise, returns false. bool GetPolicyOID(const X509Certificate::Fingerprint& fingerprint, - std::string* policy_oid) const; + PolicyOID* policy_oid) const; - const char* const* GetPolicyOIDs() const { return policy_oids_.get(); } - int NumPolicyOIDs() const { return num_policy_oids_; } + const PolicyOID* GetPolicyOIDs() const { return &policy_oids_[0]; } + int NumPolicyOIDs() const { return policy_oids_.size(); } private: EVRootCAMetadata(); @@ -35,17 +47,13 @@ class EVRootCAMetadata { friend struct DefaultSingletonTraits<EVRootCAMetadata>; - typedef std::map<X509Certificate::Fingerprint, std::string, - X509Certificate::FingerprintLessThan> StringMap; + typedef std::map<X509Certificate::Fingerprint, PolicyOID, + X509Certificate::FingerprintLessThan> PolicyOidMap; // Maps an EV root CA cert's SHA-1 fingerprint to its EV policy OID. - StringMap ev_policy_; + PolicyOidMap ev_policy_; - // Contains dotted-decimal OID strings (in ASCII). This is a C array of - // C strings so that it can be passed directly to Windows CryptoAPI as - // LPSTR*. - scoped_array<const char*> policy_oids_; - int num_policy_oids_; + std::vector<PolicyOID> policy_oids_; DISALLOW_COPY_AND_ASSIGN(EVRootCAMetadata); }; |