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

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

Issue 24348002: Migrate DBus service constants from flimflam namespace to shill namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased to ToT Created 7 years, 2 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
« no previous file with comments | « chromeos/network/client_cert_resolver_unittest.cc ('k') | chromeos/network/device_state.cc » ('j') | 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const std::string& tpm_slot, 201 const std::string& tpm_slot,
202 const std::string& tpm_pin, 202 const std::string& tpm_pin,
203 const std::string* pkcs11_id, 203 const std::string* pkcs11_id,
204 base::DictionaryValue* properties) { 204 base::DictionaryValue* properties) {
205 const char* tpm_pin_property = NULL; 205 const char* tpm_pin_property = NULL;
206 switch (cert_config_type) { 206 switch (cert_config_type) {
207 case CONFIG_TYPE_NONE: { 207 case CONFIG_TYPE_NONE: {
208 return; 208 return;
209 } 209 }
210 case CONFIG_TYPE_OPENVPN: { 210 case CONFIG_TYPE_OPENVPN: {
211 tpm_pin_property = flimflam::kOpenVPNPinProperty; 211 tpm_pin_property = shill::kOpenVPNPinProperty;
212 if (pkcs11_id) { 212 if (pkcs11_id) {
213 properties->SetStringWithoutPathExpansion( 213 properties->SetStringWithoutPathExpansion(
214 flimflam::kOpenVPNClientCertIdProperty, *pkcs11_id); 214 shill::kOpenVPNClientCertIdProperty, *pkcs11_id);
215 } 215 }
216 break; 216 break;
217 } 217 }
218 case CONFIG_TYPE_IPSEC: { 218 case CONFIG_TYPE_IPSEC: {
219 tpm_pin_property = flimflam::kL2tpIpsecPinProperty; 219 tpm_pin_property = shill::kL2tpIpsecPinProperty;
220 if (!tpm_slot.empty()) { 220 if (!tpm_slot.empty()) {
221 properties->SetStringWithoutPathExpansion( 221 properties->SetStringWithoutPathExpansion(
222 flimflam::kL2tpIpsecClientCertSlotProperty, tpm_slot); 222 shill::kL2tpIpsecClientCertSlotProperty, tpm_slot);
223 } 223 }
224 if (pkcs11_id) { 224 if (pkcs11_id) {
225 properties->SetStringWithoutPathExpansion( 225 properties->SetStringWithoutPathExpansion(
226 flimflam::kL2tpIpsecClientCertIdProperty, *pkcs11_id); 226 shill::kL2tpIpsecClientCertIdProperty, *pkcs11_id);
227 } 227 }
228 break; 228 break;
229 } 229 }
230 case CONFIG_TYPE_EAP: { 230 case CONFIG_TYPE_EAP: {
231 tpm_pin_property = flimflam::kEapPinProperty; 231 tpm_pin_property = shill::kEapPinProperty;
232 if (pkcs11_id) { 232 if (pkcs11_id) {
233 // Shill requires both CertID and KeyID for TLS connections, despite the 233 // Shill requires both CertID and KeyID for TLS connections, despite the
234 // fact that by convention they are the same ID. 234 // fact that by convention they are the same ID.
235 properties->SetStringWithoutPathExpansion(flimflam::kEapCertIdProperty, 235 properties->SetStringWithoutPathExpansion(shill::kEapCertIdProperty,
236 *pkcs11_id); 236 *pkcs11_id);
237 properties->SetStringWithoutPathExpansion(flimflam::kEapKeyIdProperty, 237 properties->SetStringWithoutPathExpansion(shill::kEapKeyIdProperty,
238 *pkcs11_id); 238 *pkcs11_id);
239 } 239 }
240 break; 240 break;
241 } 241 }
242 } 242 }
243 DCHECK(tpm_pin_property); 243 DCHECK(tpm_pin_property);
244 if (!tpm_pin.empty()) 244 if (!tpm_pin.empty())
245 properties->SetStringWithoutPathExpansion(tpm_pin_property, tpm_pin); 245 properties->SetStringWithoutPathExpansion(tpm_pin_property, tpm_pin);
246 } 246 }
247 247
248 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type, 248 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type,
249 const base::DictionaryValue& service_properties) { 249 const base::DictionaryValue& service_properties) {
250 // VPN certificate properties are read from the Provider dictionary. 250 // VPN certificate properties are read from the Provider dictionary.
251 const base::DictionaryValue* provider_properties = NULL; 251 const base::DictionaryValue* provider_properties = NULL;
252 service_properties.GetDictionaryWithoutPathExpansion( 252 service_properties.GetDictionaryWithoutPathExpansion(
253 flimflam::kProviderProperty, &provider_properties); 253 shill::kProviderProperty, &provider_properties);
254 switch (cert_config_type) { 254 switch (cert_config_type) {
255 case CONFIG_TYPE_NONE: 255 case CONFIG_TYPE_NONE:
256 return true; 256 return true;
257 case CONFIG_TYPE_OPENVPN: 257 case CONFIG_TYPE_OPENVPN:
258 // OpenVPN generally requires a passphrase and we don't know whether or 258 // OpenVPN generally requires a passphrase and we don't know whether or
259 // not one is required, so always return false here. 259 // not one is required, so always return false here.
260 return false; 260 return false;
261 case CONFIG_TYPE_IPSEC: 261 case CONFIG_TYPE_IPSEC:
262 // IPSec may require a passphrase, so return false here also. 262 // IPSec may require a passphrase, so return false here also.
263 return false; 263 return false;
264 case CONFIG_TYPE_EAP: { 264 case CONFIG_TYPE_EAP: {
265 std::string cert_id = GetStringFromDictionary( 265 std::string cert_id = GetStringFromDictionary(
266 service_properties, flimflam::kEapCertIdProperty); 266 service_properties, shill::kEapCertIdProperty);
267 std::string key_id = GetStringFromDictionary( 267 std::string key_id = GetStringFromDictionary(
268 service_properties, flimflam::kEapKeyIdProperty); 268 service_properties, shill::kEapKeyIdProperty);
269 std::string identity = GetStringFromDictionary( 269 std::string identity = GetStringFromDictionary(
270 service_properties, flimflam::kEapIdentityProperty); 270 service_properties, shill::kEapIdentityProperty);
271 return !cert_id.empty() && !key_id.empty() && !identity.empty(); 271 return !cert_id.empty() && !key_id.empty() && !identity.empty();
272 } 272 }
273 } 273 }
274 NOTREACHED(); 274 NOTREACHED();
275 return false; 275 return false;
276 } 276 }
277 277
278 } // namespace client_cert 278 } // namespace client_cert
279 279
280 } // namespace chromeos 280 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/client_cert_resolver_unittest.cc ('k') | chromeos/network/device_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698