Index: chrome/browser/chromeos/cros/network_library.cc |
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc |
index e9575aa41c682f45ea1b33c20c9b0b26de922059..61c98d76bfb0ee1991bce51ec14ac8f6c5e9bfb0 100644 |
--- a/chrome/browser/chromeos/cros/network_library.cc |
+++ b/chrome/browser/chromeos/cros/network_library.cc |
@@ -388,7 +388,26 @@ std::string WifiNetwork::GetEncryptionString() { |
case SECURITY_8021X: |
return "8021X"; |
} |
- return "Unknown";} |
+ return "Unknown"; |
+} |
+ |
+// Parse 'path' to determine if the certificate is stored in a pkcs#11 device. |
+// flimflam recognizes the string "SETTINGS:" to specify authentication |
+// parameters. 'key_id=' indicates that the certificate is stored in a pkcs#11 |
+// device. See src/third_party/flimflam/files/doc/service-api.txt. |
+bool WifiNetwork::IsCertificateLoaded() const { |
+ static const std::string settings_string("SETTINGS:"); |
+ static const std::string pkcs11_key("key_id"); |
+ if (cert_path_.find(settings_string) == 0) { |
+ std::string::size_type idx = cert_path_.find(pkcs11_key); |
+ if (idx != std::string::npos) |
+ idx = cert_path_.find_first_not_of(kWhitespaceASCII, |
+ idx + pkcs11_key.length()); |
+ if (idx != std::string::npos && cert_path_[idx] == '=') |
+ return true; |
+ } |
+ return false; |
+} |
//////////////////////////////////////////////////////////////////////////////// |
// NetworkLibrary |