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_CERT_TYPES_H_ | 5 #ifndef NET_BASE_X509_CERT_TYPES_H_ |
6 #define NET_BASE_X509_CERT_TYPES_H_ | 6 #define NET_BASE_X509_CERT_TYPES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "net/base/net_api.h" | 16 #include "net/base/net_export.h" |
17 | 17 |
18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
19 #include <Security/x509defs.h> | 19 #include <Security/x509defs.h> |
20 #endif | 20 #endif |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class Time; | 23 class Time; |
24 class StringPiece; | 24 class StringPiece; |
25 } // namespace base | 25 } // namespace base |
26 | 26 |
(...skipping 12 matching lines...) Expand all Loading... |
39 | 39 |
40 class SHA1FingerprintLessThan { | 40 class SHA1FingerprintLessThan { |
41 public: | 41 public: |
42 bool operator() (const SHA1Fingerprint& lhs, | 42 bool operator() (const SHA1Fingerprint& lhs, |
43 const SHA1Fingerprint& rhs) const { | 43 const SHA1Fingerprint& rhs) const { |
44 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; | 44 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
45 } | 45 } |
46 }; | 46 }; |
47 | 47 |
48 // CertPrincipal represents the issuer or subject field of an X.509 certificate. | 48 // CertPrincipal represents the issuer or subject field of an X.509 certificate. |
49 struct NET_API CertPrincipal { | 49 struct NET_EXPORT CertPrincipal { |
50 CertPrincipal(); | 50 CertPrincipal(); |
51 explicit CertPrincipal(const std::string& name); | 51 explicit CertPrincipal(const std::string& name); |
52 ~CertPrincipal(); | 52 ~CertPrincipal(); |
53 | 53 |
54 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
55 // Parses a BER-format DistinguishedName. | 55 // Parses a BER-format DistinguishedName. |
56 bool ParseDistinguishedName(const void* ber_name_data, size_t length); | 56 bool ParseDistinguishedName(const void* ber_name_data, size_t length); |
57 | 57 |
58 // Parses a CSSM_X509_NAME struct. | 58 // Parses a CSSM_X509_NAME struct. |
59 void Parse(const CSSM_X509_NAME* name); | 59 void Parse(const CSSM_X509_NAME* name); |
(...skipping 18 matching lines...) Expand all Loading... |
78 std::string country_name; | 78 std::string country_name; |
79 | 79 |
80 std::vector<std::string> street_addresses; | 80 std::vector<std::string> street_addresses; |
81 std::vector<std::string> organization_names; | 81 std::vector<std::string> organization_names; |
82 std::vector<std::string> organization_unit_names; | 82 std::vector<std::string> organization_unit_names; |
83 std::vector<std::string> domain_components; | 83 std::vector<std::string> domain_components; |
84 }; | 84 }; |
85 | 85 |
86 // This class is useful for maintaining policies about which certificates are | 86 // This class is useful for maintaining policies about which certificates are |
87 // permitted or forbidden for a particular purpose. | 87 // permitted or forbidden for a particular purpose. |
88 class NET_API CertPolicy { | 88 class NET_EXPORT CertPolicy { |
89 public: | 89 public: |
90 // The judgments this policy can reach. | 90 // The judgments this policy can reach. |
91 enum Judgment { | 91 enum Judgment { |
92 // We don't have policy information for this certificate. | 92 // We don't have policy information for this certificate. |
93 UNKNOWN, | 93 UNKNOWN, |
94 | 94 |
95 // This certificate is allowed. | 95 // This certificate is allowed. |
96 ALLOWED, | 96 ALLOWED, |
97 | 97 |
98 // This certificate is denied. | 98 // This certificate is denied. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as | 146 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as |
147 // |format|, and writes the result into |*time|. If an invalid date is | 147 // |format|, and writes the result into |*time|. If an invalid date is |
148 // specified, or if parsing fails, returns false, and |*time| will not be | 148 // specified, or if parsing fails, returns false, and |*time| will not be |
149 // updated. | 149 // updated. |
150 bool ParseCertificateDate(const base::StringPiece& raw_date, | 150 bool ParseCertificateDate(const base::StringPiece& raw_date, |
151 CertDateFormat format, | 151 CertDateFormat format, |
152 base::Time* time); | 152 base::Time* time); |
153 } // namespace net | 153 } // namespace net |
154 | 154 |
155 #endif // NET_BASE_X509_CERT_TYPES_H_ | 155 #endif // NET_BASE_X509_CERT_TYPES_H_ |
OLD | NEW |