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

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

Issue 370623002: Remove most of NetworkUIData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed yet-another unused function. 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_resolver.cc ('k') | chromeos/network/client_cert_util.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 #ifndef CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ 5 #ifndef CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_
6 #define CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ 6 #define CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "chromeos/chromeos_export.h" 12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/network/certificate_pattern.h"
13 14
14 namespace base { 15 namespace base {
15 class DictionaryValue; 16 class DictionaryValue;
16 } 17 }
17 18
18 namespace net { 19 namespace net {
19 struct CertPrincipal; 20 struct CertPrincipal;
20 class X509Certificate; 21 class X509Certificate;
21 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; 22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
22 } 23 }
23 24
24 namespace chromeos { 25 namespace chromeos {
25 26
26 class CertificatePattern;
27 class IssuerSubjectPattern; 27 class IssuerSubjectPattern;
28 28
29 namespace client_cert { 29 namespace client_cert {
30 30
31 enum ConfigType { 31 enum ConfigType {
32 CONFIG_TYPE_NONE, 32 CONFIG_TYPE_NONE,
33 CONFIG_TYPE_OPENVPN, 33 CONFIG_TYPE_OPENVPN,
34 CONFIG_TYPE_IPSEC, 34 CONFIG_TYPE_IPSEC,
35 CONFIG_TYPE_EAP 35 CONFIG_TYPE_EAP
36 }; 36 };
37 37
38 struct CHROMEOS_EXPORT ClientCertConfig {
39 ClientCertConfig();
40
41 // Independent of whether the client cert (pattern or reference) is
42 // configured, the location determines whether this network configuration
43 // supports client certs and what kind of configuration it requires.
44 ConfigType location;
45
46 // One of the ClientCertTypes defined in ONC: kNone, kRef, or kPattern.
47 std::string client_cert_type;
48
49 // If |client_cert_type| equals kPattern, this contains the pattern.
50 CertificatePattern pattern;
51 };
52
38 // Returns true only if any fields set in this pattern match exactly with 53 // Returns true only if any fields set in this pattern match exactly with
39 // similar fields in the principal. If organization_ or organizational_unit_ 54 // similar fields in the principal. If organization_ or organizational_unit_
40 // are set, then at least one of the organizations or units in the principal 55 // are set, then at least one of the organizations or units in the principal
41 // must match. 56 // must match.
42 bool CertPrincipalMatches(const IssuerSubjectPattern& pattern, 57 bool CertPrincipalMatches(const IssuerSubjectPattern& pattern,
43 const net::CertPrincipal& principal); 58 const net::CertPrincipal& principal);
44 59
45 // Fetches the matching certificate that has the latest valid start date. 60 // Fetches the matching certificate that has the latest valid start date.
46 // Returns a NULL refptr if there is no such match. 61 // Returns a NULL refptr if there is no such match.
47 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> GetCertificateMatch( 62 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> GetCertificateMatch(
48 const CertificatePattern& pattern, 63 const CertificatePattern& pattern,
49 const net::CertificateList& all_certs); 64 const net::CertificateList& all_certs);
50 65
51 // If not empty, sets the TPM properties in |properties|. If |pkcs11_id| is not 66 // If not empty, sets the TPM properties in |properties|. If |pkcs11_id| is not
52 // NULL, also sets the ClientCertID. |cert_config_type| determines which 67 // NULL, also sets the ClientCertID. |cert_config_type| determines which
53 // dictionary entries to set. 68 // dictionary entries to set.
54 void SetShillProperties(const ConfigType cert_config_type, 69 void SetShillProperties(const ConfigType cert_config_type,
55 const std::string& tpm_slot, 70 const std::string& tpm_slot,
56 const std::string& tpm_pin, 71 const std::string& tpm_pin,
57 const std::string* pkcs11_id, 72 const std::string* pkcs11_id,
58 base::DictionaryValue* properties); 73 base::DictionaryValue* properties);
59 74
60 // Returns true if all required configuration properties are set and not empty. 75 // Returns true if all required configuration properties are set and not empty.
61 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type, 76 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type,
62 const base::DictionaryValue& service_properties); 77 const base::DictionaryValue& service_properties);
63 78
79 // Determines the type of the CertificatePattern configuration, i.e. is it a
80 // pattern within an EAP, IPsec or OpenVPN configuration.
81 CHROMEOS_EXPORT void OncToClientCertConfig(
82 const base::DictionaryValue& network_config,
83 ClientCertConfig* cert_config);
84
64 } // namespace client_cert 85 } // namespace client_cert
65 86
66 } // namespace chromeos 87 } // namespace chromeos
67 88
68 #endif // CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ 89 #endif // CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_
OLDNEW
« no previous file with comments | « chromeos/network/client_cert_resolver.cc ('k') | chromeos/network/client_cert_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698