| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base/ev_root_ca_metadata.h" | 5 #include "net/base/ev_root_ca_metadata.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(USE_NSS) |
| 8 #include <cert.h> | 8 #include <cert.h> |
| 9 #include <pkcs11n.h> | 9 #include <pkcs11n.h> |
| 10 #include <secerr.h> | 10 #include <secerr.h> |
| 11 #include <secoid.h> | 11 #include <secoid.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/singleton.h" | 15 #include "base/singleton.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 PolicyOID* policy_oid) const { | 225 PolicyOID* policy_oid) const { |
| 226 PolicyOidMap::const_iterator iter = ev_policy_.find(fingerprint); | 226 PolicyOidMap::const_iterator iter = ev_policy_.find(fingerprint); |
| 227 if (iter == ev_policy_.end()) | 227 if (iter == ev_policy_.end()) |
| 228 return false; | 228 return false; |
| 229 *policy_oid = iter->second; | 229 *policy_oid = iter->second; |
| 230 return true; | 230 return true; |
| 231 } | 231 } |
| 232 | 232 |
| 233 EVRootCAMetadata::EVRootCAMetadata() { | 233 EVRootCAMetadata::EVRootCAMetadata() { |
| 234 // Constructs the object from the raw metadata in ev_root_ca_metadata. | 234 // Constructs the object from the raw metadata in ev_root_ca_metadata. |
| 235 #if defined(OS_LINUX) | 235 #if defined(USE_NSS) |
| 236 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { | 236 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { |
| 237 const EVMetadata& metadata = ev_root_ca_metadata[i]; | 237 const EVMetadata& metadata = ev_root_ca_metadata[i]; |
| 238 PRUint8 buf[1024]; | 238 PRUint8 buf[1024]; |
| 239 SECItem oid_item; | 239 SECItem oid_item; |
| 240 oid_item.data = buf; | 240 oid_item.data = buf; |
| 241 oid_item.len = sizeof(buf); | 241 oid_item.len = sizeof(buf); |
| 242 SECStatus status = SEC_StringToOID(NULL, &oid_item, metadata.policy_oid, 0); | 242 SECStatus status = SEC_StringToOID(NULL, &oid_item, metadata.policy_oid, 0); |
| 243 if (status != SECSuccess) { | 243 if (status != SECSuccess) { |
| 244 LOG(ERROR) << "Failed to convert to OID: " << metadata.policy_oid; | 244 LOG(ERROR) << "Failed to convert to OID: " << metadata.policy_oid; |
| 245 continue; | 245 continue; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 263 ev_policy_[metadata.fingerprint] = metadata.policy_oid; | 263 ev_policy_[metadata.fingerprint] = metadata.policy_oid; |
| 264 // Multiple root CA certs may use the same EV policy OID. Having | 264 // Multiple root CA certs may use the same EV policy OID. Having |
| 265 // duplicates in the policy_oids_ array does no harm, so we don't | 265 // duplicates in the policy_oids_ array does no harm, so we don't |
| 266 // bother detecting duplicates. | 266 // bother detecting duplicates. |
| 267 policy_oids_.push_back(metadata.policy_oid); | 267 policy_oids_.push_back(metadata.policy_oid); |
| 268 } | 268 } |
| 269 #endif | 269 #endif |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace net | 272 } // namespace net |
| OLD | NEW |