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/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <nss.h> | 8 #include <nss.h> |
9 #include <pk11pub.h> | 9 #include <pk11pub.h> |
10 #include <prerror.h> | 10 #include <prerror.h> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/nss_util.h" | 21 #include "base/nss_util.h" |
22 #include "net/base/cert_status_flags.h" | 22 #include "net/base/cert_status_flags.h" |
23 #include "net/base/cert_verify_result.h" | 23 #include "net/base/cert_verify_result.h" |
24 #include "net/base/ev_root_ca_metadata.h" | 24 #include "net/base/ev_root_ca_metadata.h" |
25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 class ScopedCERTCertificate { | |
32 public: | |
33 explicit ScopedCERTCertificate(CERTCertificate* cert) | |
34 : cert_(cert) {} | |
35 | |
36 ~ScopedCERTCertificate() { | |
37 if (cert_) | |
38 CERT_DestroyCertificate(cert_); | |
39 } | |
40 | |
41 private: | |
42 CERTCertificate* cert_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(ScopedCERTCertificate); | |
45 }; | |
46 | |
47 class ScopedCERTCertList { | |
48 public: | |
49 explicit ScopedCERTCertList(CERTCertList* cert_list) | |
50 : cert_list_(cert_list) {} | |
51 | |
52 ~ScopedCERTCertList() { | |
53 if (cert_list_) | |
54 CERT_DestroyCertList(cert_list_); | |
55 } | |
56 | |
57 private: | |
58 CERTCertList* cert_list_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ScopedCERTCertList); | |
61 }; | |
62 | |
63 class ScopedCERTCertificatePolicies { | 31 class ScopedCERTCertificatePolicies { |
64 public: | 32 public: |
65 explicit ScopedCERTCertificatePolicies(CERTCertificatePolicies* policies) | 33 explicit ScopedCERTCertificatePolicies(CERTCertificatePolicies* policies) |
66 : policies_(policies) {} | 34 : policies_(policies) {} |
67 | 35 |
68 ~ScopedCERTCertificatePolicies() { | 36 ~ScopedCERTCertificatePolicies() { |
69 if (policies_) | 37 if (policies_) |
70 CERT_DestroyCertificatePoliciesExtension(policies_); | 38 CERT_DestroyCertificatePoliciesExtension(policies_); |
71 } | 39 } |
72 | 40 |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 DCHECK(0 != cert->derCert.len); | 782 DCHECK(0 != cert->derCert.len); |
815 | 783 |
816 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data, | 784 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data, |
817 cert->derCert.data, cert->derCert.len); | 785 cert->derCert.data, cert->derCert.len); |
818 DCHECK(rv == SECSuccess); | 786 DCHECK(rv == SECSuccess); |
819 | 787 |
820 return sha1; | 788 return sha1; |
821 } | 789 } |
822 | 790 |
823 } // namespace net | 791 } // namespace net |
OLD | NEW |