OLD | NEW |
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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // must match. | 56 // must match. |
57 bool CertPrincipalMatches(const IssuerSubjectPattern& pattern, | 57 bool CertPrincipalMatches(const IssuerSubjectPattern& pattern, |
58 const net::CertPrincipal& principal); | 58 const net::CertPrincipal& principal); |
59 | 59 |
60 // Fetches the matching certificate that has the latest valid start date. | 60 // Fetches the matching certificate that has the latest valid start date. |
61 // Returns a NULL refptr if there is no such match. | 61 // Returns a NULL refptr if there is no such match. |
62 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> GetCertificateMatch( | 62 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> GetCertificateMatch( |
63 const CertificatePattern& pattern, | 63 const CertificatePattern& pattern, |
64 const net::CertificateList& all_certs); | 64 const net::CertificateList& all_certs); |
65 | 65 |
| 66 // Returns the PKCS11 id part of |cert_id|, which is expected to be the value of |
| 67 // the Shill property kEapCertIdProperty or kEapKeyIdProperty. |
| 68 CHROMEOS_EXPORT std::string GetPkcs11IdFromEapCertId( |
| 69 const std::string& cert_id); |
| 70 |
66 // If not empty, sets the TPM properties in |properties|. If |pkcs11_id| is not | 71 // If not empty, sets the TPM properties in |properties|. If |pkcs11_id| is not |
67 // NULL, also sets the ClientCertID. |cert_config_type| determines which | 72 // NULL, also sets the ClientCertID. |cert_config_type| determines which |
68 // dictionary entries to set. | 73 // dictionary entries to set. |
69 CHROMEOS_EXPORT void SetShillProperties(const ConfigType cert_config_type, | 74 CHROMEOS_EXPORT void SetShillProperties(const ConfigType cert_config_type, |
70 const std::string& tpm_slot, | 75 const std::string& tpm_slot, |
71 const std::string& tpm_pin, | 76 const std::string& tpm_pin, |
72 const std::string* pkcs11_id, | 77 const std::string* pkcs11_id, |
73 base::DictionaryValue* properties); | 78 base::DictionaryValue* properties); |
74 | 79 |
75 // Returns true if all required configuration properties are set and not empty. | 80 // Returns true if all required configuration properties are set and not empty. |
76 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type, | 81 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type, |
77 const base::DictionaryValue& service_properties); | 82 const base::DictionaryValue& service_properties); |
78 | 83 |
79 // Determines the type of the CertificatePattern configuration, i.e. is it a | 84 // Determines the type of the CertificatePattern configuration, i.e. is it a |
80 // pattern within an EAP, IPsec or OpenVPN configuration. | 85 // pattern within an EAP, IPsec or OpenVPN configuration. |
81 CHROMEOS_EXPORT void OncToClientCertConfig( | 86 CHROMEOS_EXPORT void OncToClientCertConfig( |
82 const base::DictionaryValue& network_config, | 87 const base::DictionaryValue& network_config, |
83 ClientCertConfig* cert_config); | 88 ClientCertConfig* cert_config); |
84 | 89 |
85 } // namespace client_cert | 90 } // namespace client_cert |
86 | 91 |
87 } // namespace chromeos | 92 } // namespace chromeos |
88 | 93 |
89 #endif // CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ | 94 #endif // CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ |
OLD | NEW |