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

Side by Side Diff: chromeos/network/client_cert_util.cc

Issue 410113002: Fix WiFi config view for previously configured client cert. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/network/client_cert_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chromeos/network/client_cert_util.h" 5 #include "chromeos/network/client_cert_util.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <pk11pub.h> 8 #include <pk11pub.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Iterate over the rest looking for the one that was issued latest. 211 // Iterate over the rest looking for the one that was issued latest.
212 for (CertificateStlList::iterator iter = matching_certs.begin(); 212 for (CertificateStlList::iterator iter = matching_certs.begin();
213 iter != matching_certs.end(); ++iter) { 213 iter != matching_certs.end(); ++iter) {
214 if (!latest.get() || (*iter)->valid_start() > latest->valid_start()) 214 if (!latest.get() || (*iter)->valid_start() > latest->valid_start())
215 latest = *iter; 215 latest = *iter;
216 } 216 }
217 217
218 return latest; 218 return latest;
219 } 219 }
220 220
221 std::string GetPkcs11IdFromEapCertId(const std::string& cert_id) {
222 if (cert_id.empty())
223 return std::string();
224
225 size_t delimiter_pos = cert_id.find(':');
226 if (delimiter_pos == std::string::npos) {
227 // No delimiter found, so |cert_id| only contains the PKCS11 id.
228 return cert_id;
229 }
230 if (delimiter_pos + 1 >= cert_id.size()) {
231 LOG(ERROR) << "Empty PKCS11 id in cert id.";
232 return std::string();
233 }
234 return cert_id.substr(delimiter_pos + 1);
235 }
236
221 void SetShillProperties(const ConfigType cert_config_type, 237 void SetShillProperties(const ConfigType cert_config_type,
222 const std::string& tpm_slot, 238 const std::string& tpm_slot,
223 const std::string& tpm_pin, 239 const std::string& tpm_pin,
224 const std::string* pkcs11_id, 240 const std::string* pkcs11_id,
225 base::DictionaryValue* properties) { 241 base::DictionaryValue* properties) {
226 const char* tpm_pin_property = NULL; 242 const char* tpm_pin_property = NULL;
227 switch (cert_config_type) { 243 switch (cert_config_type) {
228 case CONFIG_TYPE_NONE: { 244 case CONFIG_TYPE_NONE: {
229 return; 245 return;
230 } 246 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 return !cert_id.empty() && !key_id.empty() && !identity.empty(); 385 return !cert_id.empty() && !key_id.empty() && !identity.empty();
370 } 386 }
371 } 387 }
372 NOTREACHED(); 388 NOTREACHED();
373 return false; 389 return false;
374 } 390 }
375 391
376 } // namespace client_cert 392 } // namespace client_cert
377 393
378 } // namespace chromeos 394 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/client_cert_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698