OLD | NEW |
---|---|
1 // Copyright (c) 2010 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 | 17 |
17 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
18 #include <Security/x509defs.h> | 19 #include <Security/x509defs.h> |
19 #endif | 20 #endif |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class Time; | 23 class Time; |
23 class StringPiece; | 24 class StringPiece; |
24 } // namespace base | 25 } // namespace base |
25 | 26 |
(...skipping 12 matching lines...) Expand all Loading... | |
38 | 39 |
39 class SHA1FingerprintLessThan { | 40 class SHA1FingerprintLessThan { |
40 public: | 41 public: |
41 bool operator() (const SHA1Fingerprint& lhs, | 42 bool operator() (const SHA1Fingerprint& lhs, |
42 const SHA1Fingerprint& rhs) const { | 43 const SHA1Fingerprint& rhs) const { |
43 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; | 44 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
44 } | 45 } |
45 }; | 46 }; |
46 | 47 |
47 // 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. |
48 struct CertPrincipal { | 49 struct NET_TEST CertPrincipal { |
wtc
2011/05/16 20:55:17
CertPrincipal should be NET_API because
X509Certif
| |
49 CertPrincipal(); | 50 CertPrincipal(); |
50 explicit CertPrincipal(const std::string& name); | 51 explicit CertPrincipal(const std::string& name); |
51 ~CertPrincipal(); | 52 ~CertPrincipal(); |
52 | 53 |
53 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
54 // Parses a BER-format DistinguishedName. | 55 // Parses a BER-format DistinguishedName. |
55 bool ParseDistinguishedName(const void* ber_name_data, size_t length); | 56 bool ParseDistinguishedName(const void* ber_name_data, size_t length); |
56 | 57 |
57 // Parses a CSSM_X509_NAME struct. | 58 // Parses a CSSM_X509_NAME struct. |
58 void Parse(const CSSM_X509_NAME* name); | 59 void Parse(const CSSM_X509_NAME* name); |
(...skipping 18 matching lines...) Expand all Loading... | |
77 std::string country_name; | 78 std::string country_name; |
78 | 79 |
79 std::vector<std::string> street_addresses; | 80 std::vector<std::string> street_addresses; |
80 std::vector<std::string> organization_names; | 81 std::vector<std::string> organization_names; |
81 std::vector<std::string> organization_unit_names; | 82 std::vector<std::string> organization_unit_names; |
82 std::vector<std::string> domain_components; | 83 std::vector<std::string> domain_components; |
83 }; | 84 }; |
84 | 85 |
85 // This class is useful for maintaining policies about which certificates are | 86 // This class is useful for maintaining policies about which certificates are |
86 // permitted or forbidden for a particular purpose. | 87 // permitted or forbidden for a particular purpose. |
87 class CertPolicy { | 88 class NET_API CertPolicy { |
88 public: | 89 public: |
89 // The judgments this policy can reach. | 90 // The judgments this policy can reach. |
90 enum Judgment { | 91 enum Judgment { |
91 // We don't have policy information for this certificate. | 92 // We don't have policy information for this certificate. |
92 UNKNOWN, | 93 UNKNOWN, |
93 | 94 |
94 // This certificate is allowed. | 95 // This certificate is allowed. |
95 ALLOWED, | 96 ALLOWED, |
96 | 97 |
97 // This certificate is denied. | 98 // This certificate is denied. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 // 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 |
146 // |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 |
147 // 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 |
148 // updated. | 149 // updated. |
149 bool ParseCertificateDate(const base::StringPiece& raw_date, | 150 bool ParseCertificateDate(const base::StringPiece& raw_date, |
150 CertDateFormat format, | 151 CertDateFormat format, |
151 base::Time* time); | 152 base::Time* time); |
152 } // namespace net | 153 } // namespace net |
153 | 154 |
154 #endif // NET_BASE_X509_CERT_TYPES_H_ | 155 #endif // NET_BASE_X509_CERT_TYPES_H_ |
OLD | NEW |