shill: EAPCredentials: Use PEM arrays for CACertPEM
Switch the "CACertPEM" option to use a string array of PEM.
wpa_supplicant is equally capable of accepting PEM and DER
certificates for its "ca_cert" option. Since it's not easy
to export multiple certificates in a single DER file, use
a PEM file instead of DER for the output file in the CaCertPEM
case.
BUG=chromium:249363
TEST=Unit tests.
Change-Id: I3dd8389a3b099a368924459521f4978effe12b7a
Reviewed-on: https://gerrit.chromium.org/gerrit/60522
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/eap_credentials_unittest.cc b/eap_credentials_unittest.cc
index 25e8593..a05f568 100644
--- a/eap_credentials_unittest.cc
+++ b/eap_credentials_unittest.cc
@@ -50,7 +50,7 @@
void SetCACertNSS(const string &ca_cert_nss) {
eap_.ca_cert_nss_ = ca_cert_nss;
}
- void SetCACertPEM(const string &ca_cert_pem) {
+ void SetCACertPEM(const vector<string> &ca_cert_pem) {
eap_.ca_cert_pem_ = ca_cert_pem;
}
void SetClientCert(const string &client_cert) {
@@ -372,11 +372,11 @@
}
TEST_F(EapCredentialsTest, PopulateSupplicantPropertiesPEM) {
- const string kPemCert("-pem-certificate-here-");
+ const vector<string> kPemCert{ "-pem-certificate-here-" };
SetCACertPEM(kPemCert);
const string kPEMCertfile("/tmp/pem-cert");
FilePath pem_cert(kPEMCertfile);
- EXPECT_CALL(certificate_file_, CreateDERFromString(kPemCert))
+ EXPECT_CALL(certificate_file_, CreatePEMFromStrings(kPemCert))
.WillOnce(Return(pem_cert));
PopulateSupplicantProperties();
@@ -424,7 +424,7 @@
EXPECT_TRUE(GetKeyManagement().empty());
SetAnonymousIdentity("foo");
SetCACertNSS("foo");
- SetCACertPEM("foo");
+ SetCACertPEM(vector<string>{ "foo" });
SetClientCert("foo");
SetCertId("foo");
SetEap("foo");