Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: net/base/x509_cert_types.h

Issue 10834051: Bringing up the net target on iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #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 7
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/string_piece.h" 14 #include "base/string_piece.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "net/base/net_export.h" 16 #include "net/base/net_export.h"
17 17
18 #if defined(OS_MACOSX) 18 #if defined(OS_MACOSX) && !defined(OS_IOS)
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 } // namespace base 24 } // namespace base
25 25
26 namespace net { 26 namespace net {
27 27
28 class X509Certificate; 28 class X509Certificate;
(...skipping 27 matching lines...) Expand all
56 bool NET_EXPORT IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, 56 bool NET_EXPORT IsSHA1HashInSortedArray(const SHA1Fingerprint& hash,
57 const uint8* array, 57 const uint8* array,
58 size_t array_byte_len); 58 size_t array_byte_len);
59 59
60 // CertPrincipal represents the issuer or subject field of an X.509 certificate. 60 // CertPrincipal represents the issuer or subject field of an X.509 certificate.
61 struct NET_EXPORT CertPrincipal { 61 struct NET_EXPORT CertPrincipal {
62 CertPrincipal(); 62 CertPrincipal();
63 explicit CertPrincipal(const std::string& name); 63 explicit CertPrincipal(const std::string& name);
64 ~CertPrincipal(); 64 ~CertPrincipal();
65 65
66 #if defined(OS_MACOSX) || defined(OS_WIN) 66 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN)
67 // Parses a BER-format DistinguishedName. 67 // Parses a BER-format DistinguishedName.
68 bool ParseDistinguishedName(const void* ber_name_data, size_t length); 68 bool ParseDistinguishedName(const void* ber_name_data, size_t length);
69 #endif 69 #endif
70 70
71 #if defined(OS_MACOSX) 71 #if defined(OS_MACOSX)
72 // Compare this CertPrincipal with |against|, returning true if they're 72 // Compare this CertPrincipal with |against|, returning true if they're
73 // equal enough to be a possible match. This should NOT be used for any 73 // equal enough to be a possible match. This should NOT be used for any
74 // security relevant decisions. 74 // security relevant decisions.
75 // TODO(rsleevi): Remove once Mac client auth uses NSS for name comparison. 75 // TODO(rsleevi): Remove once Mac client auth uses NSS for name comparison.
76 bool Matches(const CertPrincipal& against) const; 76 bool Matches(const CertPrincipal& against) const;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bool HasDeniedCert() const; 129 bool HasDeniedCert() const;
130 130
131 private: 131 private:
132 // The set of fingerprints of allowed certificates. 132 // The set of fingerprints of allowed certificates.
133 std::set<SHA1Fingerprint, SHA1FingerprintLessThan> allowed_; 133 std::set<SHA1Fingerprint, SHA1FingerprintLessThan> allowed_;
134 134
135 // The set of fingerprints of denied certificates. 135 // The set of fingerprints of denied certificates.
136 std::set<SHA1Fingerprint, SHA1FingerprintLessThan> denied_; 136 std::set<SHA1Fingerprint, SHA1FingerprintLessThan> denied_;
137 }; 137 };
138 138
139 #if defined(OS_MACOSX) 139 #if defined(OS_MACOSX) && !defined(OS_IOS)
140 // Compares two OIDs by value. 140 // Compares two OIDs by value.
141 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { 141 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) {
142 return oid1->Length == oid2->Length && 142 return oid1->Length == oid2->Length &&
143 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); 143 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0);
144 } 144 }
145 #endif 145 #endif
146 146
147 // A list of ASN.1 date/time formats that ParseCertificateDate() supports, 147 // A list of ASN.1 date/time formats that ParseCertificateDate() supports,
148 // encoded in the canonical forms specified in RFC 2459/3280/5280. 148 // encoded in the canonical forms specified in RFC 2459/3280/5280.
149 enum CertDateFormat { 149 enum CertDateFormat {
150 // UTCTime: Format is YYMMDDHHMMSSZ 150 // UTCTime: Format is YYMMDDHHMMSSZ
151 CERT_DATE_FORMAT_UTC_TIME, 151 CERT_DATE_FORMAT_UTC_TIME,
152 152
153 // GeneralizedTime: Format is YYYYMMDDHHMMSSZ 153 // GeneralizedTime: Format is YYYYMMDDHHMMSSZ
154 CERT_DATE_FORMAT_GENERALIZED_TIME, 154 CERT_DATE_FORMAT_GENERALIZED_TIME,
155 }; 155 };
156 156
157 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as 157 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as
158 // |format|, and writes the result into |*time|. If an invalid date is 158 // |format|, and writes the result into |*time|. If an invalid date is
159 // specified, or if parsing fails, returns false, and |*time| will not be 159 // specified, or if parsing fails, returns false, and |*time| will not be
160 // updated. 160 // updated.
161 bool ParseCertificateDate(const base::StringPiece& raw_date, 161 bool ParseCertificateDate(const base::StringPiece& raw_date,
162 CertDateFormat format, 162 CertDateFormat format,
163 base::Time* time); 163 base::Time* time);
164 } // namespace net 164 } // namespace net
165 165
166 #endif // NET_BASE_X509_CERT_TYPES_H_ 166 #endif // NET_BASE_X509_CERT_TYPES_H_
OLDNEW
« no previous file with comments | « net/base/platform_mime_util_mac.mm ('k') | net/net.gyp » ('j') | net/net.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698