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/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
6 | 6 |
7 #include <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
10 | 10 |
wtc
2014/02/26 17:57:01
Please delete this blank line.
| |
11 #include <cert.h> | |
12 | 11 |
13 #include <vector> | 12 #include <vector> |
14 | 13 |
15 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
16 #include "base/logging.h" | 15 #include "base/logging.h" |
17 #include "base/mac/mac_logging.h" | 16 #include "base/mac/mac_logging.h" |
18 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
19 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
20 #include "base/pickle.h" | 19 #include "base/pickle.h" |
21 #include "base/sha1.h" | 20 #include "base/sha1.h" |
22 #include "base/strings/string_piece.h" | 21 #include "base/strings/string_piece.h" |
23 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
24 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
25 #include "crypto/cssm_init.h" | 24 #include "crypto/cssm_init.h" |
26 #include "crypto/mac_security_services_lock.h" | 25 #include "crypto/mac_security_services_lock.h" |
27 #include "crypto/nss_util.h" | |
28 #include "net/cert/x509_util_mac.h" | 26 #include "net/cert/x509_util_mac.h" |
29 | 27 |
30 using base::ScopedCFTypeRef; | 28 using base::ScopedCFTypeRef; |
31 using base::Time; | 29 using base::Time; |
32 | 30 |
33 namespace net { | 31 namespace net { |
34 | 32 |
35 namespace { | 33 namespace { |
36 | 34 |
37 void GetCertDistinguishedName( | 35 void GetCertDistinguishedName( |
(...skipping 161 matching lines...) Loading... | |
199 } | 197 } |
200 } | 198 } |
201 | 199 |
202 struct CSSMOIDString { | 200 struct CSSMOIDString { |
203 const CSSM_OID* oid_; | 201 const CSSM_OID* oid_; |
204 std::string string_; | 202 std::string string_; |
205 }; | 203 }; |
206 | 204 |
207 typedef std::vector<CSSMOIDString> CSSMOIDStringVector; | 205 typedef std::vector<CSSMOIDString> CSSMOIDStringVector; |
208 | 206 |
209 class ScopedCertName { | |
210 public: | |
211 explicit ScopedCertName(CERTName* name) : name_(name) { } | |
212 ~ScopedCertName() { | |
213 if (name_) CERT_DestroyName(name_); | |
214 } | |
215 operator CERTName*() { return name_; } | |
216 | |
217 private: | |
218 CERTName* name_; | |
219 }; | |
220 | |
221 class ScopedEncodedCertResults { | 207 class ScopedEncodedCertResults { |
222 public: | 208 public: |
223 explicit ScopedEncodedCertResults(CSSM_TP_RESULT_SET* results) | 209 explicit ScopedEncodedCertResults(CSSM_TP_RESULT_SET* results) |
224 : results_(results) { } | 210 : results_(results) { } |
225 ~ScopedEncodedCertResults() { | 211 ~ScopedEncodedCertResults() { |
226 if (results_) { | 212 if (results_) { |
227 CSSM_ENCODED_CERT* encCert = | 213 CSSM_ENCODED_CERT* encCert = |
228 reinterpret_cast<CSSM_ENCODED_CERT*>(results_->Results); | 214 reinterpret_cast<CSSM_ENCODED_CERT*>(results_->Results); |
229 for (uint32 i = 0; i < results_->NumberOfResults; i++) { | 215 for (uint32 i = 0; i < results_->NumberOfResults; i++) { |
230 crypto::CSSMFree(encCert[i].CertBlob.Data); | 216 crypto::CSSMFree(encCert[i].CertBlob.Data); |
(...skipping 317 matching lines...) Loading... | |
548 *type = kPublicKeyTypeDH; | 534 *type = kPublicKeyTypeDH; |
549 break; | 535 break; |
550 default: | 536 default: |
551 *type = kPublicKeyTypeUnknown; | 537 *type = kPublicKeyTypeUnknown; |
552 *size_bits = 0; | 538 *size_bits = 0; |
553 break; | 539 break; |
554 } | 540 } |
555 } | 541 } |
556 | 542 |
557 } // namespace net | 543 } // namespace net |
OLD | NEW |