OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/base/x509_cert_types.h" | 5 #include "net/base/x509_cert_types.h" |
6 | 6 |
7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
8 #include <Security/Security.h> | 8 #include <Security/Security.h> |
9 #include <Security/SecAsn1Coder.h> | 9 #include <Security/SecAsn1Coder.h> |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 break; | 143 break; |
144 } | 144 } |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 // Stores the first string of the vector, if any, to *single_value. | 148 // Stores the first string of the vector, if any, to *single_value. |
149 void SetSingle(const std::vector<std::string>& values, | 149 void SetSingle(const std::vector<std::string>& values, |
150 std::string* single_value) { | 150 std::string* single_value) { |
151 // We don't expect to have more than one CN, L, S, and C. | 151 // We don't expect to have more than one CN, L, S, and C. |
152 LOG_IF(WARNING, values.size() > 1) << "Didn't expect multiple values"; | 152 LOG_IF(WARNING, values.size() > 1) << "Didn't expect multiple values"; |
153 if (values.size() > 0) | 153 if (!values.empty()) |
154 *single_value = values[0]; | 154 *single_value = values[0]; |
155 } | 155 } |
156 | 156 |
157 bool match(const std::string& str, const std::string& against) { | 157 bool match(const std::string& str, const std::string& against) { |
158 // TODO(snej): Use the full matching rules specified in RFC 5280 sec. 7.1 | 158 // TODO(snej): Use the full matching rules specified in RFC 5280 sec. 7.1 |
159 // including trimming and case-folding: <http://www.ietf.org/rfc/rfc5280.txt>. | 159 // including trimming and case-folding: <http://www.ietf.org/rfc/rfc5280.txt>. |
160 return against == str; | 160 return against == str; |
161 } | 161 } |
162 | 162 |
163 bool match(const std::vector<std::string>& rdn1, | 163 bool match(const std::vector<std::string>& rdn1, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 match(locality_name, against.locality_name) && | 302 match(locality_name, against.locality_name) && |
303 match(state_or_province_name, against.state_or_province_name) && | 303 match(state_or_province_name, against.state_or_province_name) && |
304 match(country_name, against.country_name) && | 304 match(country_name, against.country_name) && |
305 match(street_addresses, against.street_addresses) && | 305 match(street_addresses, against.street_addresses) && |
306 match(organization_names, against.organization_names) && | 306 match(organization_names, against.organization_names) && |
307 match(organization_unit_names, against.organization_unit_names) && | 307 match(organization_unit_names, against.organization_unit_names) && |
308 match(domain_components, against.domain_components); | 308 match(domain_components, against.domain_components); |
309 } | 309 } |
310 | 310 |
311 } // namespace net | 311 } // namespace net |
OLD | NEW |