OLD | NEW |
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_CERT_X509_CERT_TYPES_H_ | 5 #ifndef NET_CERT_X509_CERT_TYPES_H_ |
6 #define NET_CERT_X509_CERT_TYPES_H_ | 6 #define NET_CERT_X509_CERT_TYPES_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 std::map<SHA1HashValue, CertStatus, SHA1HashValueLessThan> allowed_; | 111 std::map<SHA1HashValue, CertStatus, SHA1HashValueLessThan> allowed_; |
112 | 112 |
113 // The set of fingerprints of denied certificates. | 113 // The set of fingerprints of denied certificates. |
114 std::map<SHA1HashValue, CertStatus, SHA1HashValueLessThan> denied_; | 114 std::map<SHA1HashValue, CertStatus, SHA1HashValueLessThan> denied_; |
115 }; | 115 }; |
116 | 116 |
117 #if defined(OS_MACOSX) && !defined(OS_IOS) | 117 #if defined(OS_MACOSX) && !defined(OS_IOS) |
118 // Compares two OIDs by value. | 118 // Compares two OIDs by value. |
119 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { | 119 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { |
120 return oid1->Length == oid2->Length && | 120 return oid1->Length == oid2->Length && |
121 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); | 121 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); |
122 } | 122 } |
123 #endif | 123 #endif |
124 | 124 |
125 // A list of ASN.1 date/time formats that ParseCertificateDate() supports, | 125 // A list of ASN.1 date/time formats that ParseCertificateDate() supports, |
126 // encoded in the canonical forms specified in RFC 2459/3280/5280. | 126 // encoded in the canonical forms specified in RFC 2459/3280/5280. |
127 enum CertDateFormat { | 127 enum CertDateFormat { |
128 // UTCTime: Format is YYMMDDHHMMSSZ | 128 // UTCTime: Format is YYMMDDHHMMSSZ |
129 CERT_DATE_FORMAT_UTC_TIME, | 129 CERT_DATE_FORMAT_UTC_TIME, |
130 | 130 |
131 // GeneralizedTime: Format is YYYYMMDDHHMMSSZ | 131 // GeneralizedTime: Format is YYYYMMDDHHMMSSZ |
132 CERT_DATE_FORMAT_GENERALIZED_TIME, | 132 CERT_DATE_FORMAT_GENERALIZED_TIME, |
133 }; | 133 }; |
134 | 134 |
135 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as | 135 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as |
136 // |format|, and writes the result into |*time|. If an invalid date is | 136 // |format|, and writes the result into |*time|. If an invalid date is |
137 // specified, or if parsing fails, returns false, and |*time| will not be | 137 // specified, or if parsing fails, returns false, and |*time| will not be |
138 // updated. | 138 // updated. |
139 NET_EXPORT_PRIVATE bool ParseCertificateDate(const base::StringPiece& raw_date, | 139 NET_EXPORT_PRIVATE bool ParseCertificateDate(const base::StringPiece& raw_date, |
140 CertDateFormat format, | 140 CertDateFormat format, |
141 base::Time* time); | 141 base::Time* time); |
142 } // namespace net | 142 } // namespace net |
143 | 143 |
144 #endif // NET_CERT_X509_CERT_TYPES_H_ | 144 #endif // NET_CERT_X509_CERT_TYPES_H_ |
OLD | NEW |