OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_BASE_X509_CERTIFICATE_H_ | 5 #ifndef NET_BASE_X509_CERTIFICATE_H_ |
6 #define NET_BASE_X509_CERTIFICATE_H_ | 6 #define NET_BASE_X509_CERTIFICATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "net/base/net_api.h" | 18 #include "net/base/net_export.h" |
19 #include "net/base/x509_cert_types.h" | 19 #include "net/base/x509_cert_types.h" |
20 | 20 |
21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
22 #include <windows.h> | 22 #include <windows.h> |
23 #include <wincrypt.h> | 23 #include <wincrypt.h> |
24 #elif defined(OS_MACOSX) | 24 #elif defined(OS_MACOSX) |
25 #include <CoreFoundation/CFArray.h> | 25 #include <CoreFoundation/CFArray.h> |
26 #include <Security/SecBase.h> | 26 #include <Security/SecBase.h> |
27 | 27 |
28 #include "base/synchronization/lock.h" | 28 #include "base/synchronization/lock.h" |
(...skipping 16 matching lines...) Expand all Loading... |
45 namespace net { | 45 namespace net { |
46 | 46 |
47 class CertVerifyResult; | 47 class CertVerifyResult; |
48 | 48 |
49 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 49 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
50 | 50 |
51 // X509Certificate represents a X.509 certificate, which is comprised a | 51 // X509Certificate represents a X.509 certificate, which is comprised a |
52 // particular identity or end-entity certificate, such as an SSL server | 52 // particular identity or end-entity certificate, such as an SSL server |
53 // identity or an SSL client certificate, and zero or more intermediate | 53 // identity or an SSL client certificate, and zero or more intermediate |
54 // certificates that may be used to build a path to a root certificate. | 54 // certificates that may be used to build a path to a root certificate. |
55 class NET_API X509Certificate | 55 class NET_EXPORT X509Certificate |
56 : public base::RefCountedThreadSafe<X509Certificate> { | 56 : public base::RefCountedThreadSafe<X509Certificate> { |
57 public: | 57 public: |
58 // A handle to the certificate object in the underlying crypto library. | 58 // A handle to the certificate object in the underlying crypto library. |
59 // We assume that OSCertHandle is a pointer type on all platforms and | 59 // We assume that OSCertHandle is a pointer type on all platforms and |
60 // NULL is an invalid OSCertHandle. | 60 // NULL is an invalid OSCertHandle. |
61 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
62 typedef PCCERT_CONTEXT OSCertHandle; | 62 typedef PCCERT_CONTEXT OSCertHandle; |
63 #elif defined(OS_MACOSX) | 63 #elif defined(OS_MACOSX) |
64 typedef SecCertificateRef OSCertHandle; | 64 typedef SecCertificateRef OSCertHandle; |
65 #elif defined(USE_OPENSSL) | 65 #elif defined(USE_OPENSSL) |
66 typedef struct x509_st* OSCertHandle; | 66 typedef struct x509_st* OSCertHandle; |
67 #elif defined(USE_NSS) | 67 #elif defined(USE_NSS) |
68 typedef struct CERTCertificateStr* OSCertHandle; | 68 typedef struct CERTCertificateStr* OSCertHandle; |
69 #else | 69 #else |
70 // TODO(ericroman): not implemented | 70 // TODO(ericroman): not implemented |
71 typedef void* OSCertHandle; | 71 typedef void* OSCertHandle; |
72 #endif | 72 #endif |
73 | 73 |
74 typedef std::vector<OSCertHandle> OSCertHandles; | 74 typedef std::vector<OSCertHandle> OSCertHandles; |
75 | 75 |
76 // Predicate functor used in maps when X509Certificate is used as the key. | 76 // Predicate functor used in maps when X509Certificate is used as the key. |
77 class NET_API LessThan { | 77 class NET_EXPORT LessThan { |
78 public: | 78 public: |
79 bool operator() (X509Certificate* lhs, X509Certificate* rhs) const; | 79 bool operator() (X509Certificate* lhs, X509Certificate* rhs) const; |
80 }; | 80 }; |
81 | 81 |
82 enum VerifyFlags { | 82 enum VerifyFlags { |
83 VERIFY_REV_CHECKING_ENABLED = 1 << 0, | 83 VERIFY_REV_CHECKING_ENABLED = 1 << 0, |
84 VERIFY_EV_CERT = 1 << 1, | 84 VERIFY_EV_CERT = 1 << 1, |
85 }; | 85 }; |
86 | 86 |
87 enum Format { | 87 enum Format { |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // (Marked mutable because it's used in a const method.) | 469 // (Marked mutable because it's used in a const method.) |
470 mutable base::Lock verification_lock_; | 470 mutable base::Lock verification_lock_; |
471 #endif | 471 #endif |
472 | 472 |
473 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 473 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
474 }; | 474 }; |
475 | 475 |
476 } // namespace net | 476 } // namespace net |
477 | 477 |
478 #endif // NET_BASE_X509_CERTIFICATE_H_ | 478 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |