OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/cert/ev_root_ca_metadata.h" | 5 #include "net/cert/ev_root_ca_metadata.h" |
6 | 6 |
7 #include "net/cert/x509_cert_types.h" | 7 #include "net/cert/x509_cert_types.h" |
8 #include "net/test/cert_test_util.h" | 8 #include "net/test/cert_test_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 #if defined(USE_NSS_CERTS) | 11 #if defined(USE_NSS_CERTS) |
| 12 #include "crypto/nss_util.h" |
12 #include "crypto/scoped_nss_types.h" | 13 #include "crypto/scoped_nss_types.h" |
13 #endif | 14 #endif |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 #if defined(USE_NSS_CERTS) || defined(OS_WIN) | 20 #if defined(USE_NSS_CERTS) || defined(OS_WIN) |
20 const char kVerisignPolicy[] = "2.16.840.1.113733.1.7.23.6"; | 21 const char kVerisignPolicy[] = "2.16.840.1.113733.1.7.23.6"; |
21 const char kThawtePolicy[] = "2.16.840.1.113733.1.7.48.1"; | 22 const char kThawtePolicy[] = "2.16.840.1.113733.1.7.48.1"; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return SECOID_AddEntry(&oid_data); | 57 return SECOID_AddEntry(&oid_data); |
57 } | 58 } |
58 | 59 |
59 EVOidData::EVOidData() | 60 EVOidData::EVOidData() |
60 : verisign_policy(SEC_OID_UNKNOWN), | 61 : verisign_policy(SEC_OID_UNKNOWN), |
61 thawte_policy(SEC_OID_UNKNOWN), | 62 thawte_policy(SEC_OID_UNKNOWN), |
62 fake_policy(SEC_OID_UNKNOWN) { | 63 fake_policy(SEC_OID_UNKNOWN) { |
63 } | 64 } |
64 | 65 |
65 bool EVOidData::Init() { | 66 bool EVOidData::Init() { |
| 67 crypto::EnsureNSSInit(); |
66 crypto::ScopedPLArenaPool pool(PORT_NewArena(DER_DEFAULT_CHUNKSIZE)); | 68 crypto::ScopedPLArenaPool pool(PORT_NewArena(DER_DEFAULT_CHUNKSIZE)); |
67 if (!pool.get()) | 69 if (!pool.get()) |
68 return false; | 70 return false; |
69 | 71 |
70 verisign_policy = RegisterOID(pool.get(), kVerisignPolicy); | 72 verisign_policy = RegisterOID(pool.get(), kVerisignPolicy); |
71 thawte_policy = RegisterOID(pool.get(), kThawtePolicy); | 73 thawte_policy = RegisterOID(pool.get(), kThawtePolicy); |
72 fake_policy = RegisterOID(pool.get(), kFakePolicy); | 74 fake_policy = RegisterOID(pool.get(), kFakePolicy); |
73 | 75 |
74 return verisign_policy != SEC_OID_UNKNOWN && | 76 return verisign_policy != SEC_OID_UNKNOWN && |
75 thawte_policy != SEC_OID_UNKNOWN && | 77 thawte_policy != SEC_OID_UNKNOWN && |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 EXPECT_FALSE(ev_metadata->IsEVPolicyOID(ev_oid_data.fake_policy)); | 135 EXPECT_FALSE(ev_metadata->IsEVPolicyOID(ev_oid_data.fake_policy)); |
134 EXPECT_FALSE(ev_metadata->HasEVPolicyOID(kFakeFingerprint, | 136 EXPECT_FALSE(ev_metadata->HasEVPolicyOID(kFakeFingerprint, |
135 ev_oid_data.fake_policy)); | 137 ev_oid_data.fake_policy)); |
136 } | 138 } |
137 | 139 |
138 #endif // defined(USE_NSS_CERTS) || defined(OS_WIN) | 140 #endif // defined(USE_NSS_CERTS) || defined(OS_WIN) |
139 | 141 |
140 } // namespace | 142 } // namespace |
141 | 143 |
142 } // namespace net | 144 } // namespace net |
OLD | NEW |